答:
Emacs Lisp 221 Bytes

```<code>(defun g(a b)(when(string-match a s)(throw s(replace-match b'()'()s))))
(defun f(s)(catch s(dolist(l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))(let((a(car l))(d(cdr l))(case-fold-search t))(g a d)(g d a)))))
</code>```

Ungolfed:

```<code>(defun g (a b)
  ;; when a is in s (dynamical scope) throws the replacement string
  (when (string-match a s)
    (throw s (replace-match b nil nil s))))

(defun f (s)
  (catch s ; catch replacement
    (dolist (l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))
      (let ((a(car l))
            (d(cdr l))
            ;; Emacs string-match ignores case, when case-fold-search is true.
            ;; The standard is t, but through customization/local variables
            ;; this can change. Therefore we set it explicitly.
            ;; We could have saved 20 bytes here...
            (case-fold-search t))
        (g a d)
        (g d a)))))
</code>```

The main "feature" here, is that string-match can be made to ignore case and that replace-match is somewhat intelligent with replacing. For instance, this would also work with TRUE and FALSE. We also exploit dynamical scope to save typing.

Body:
Your dumb teacher is always wrong, so flip his answer.

Change these responses

```<code>True -> False
Yes -> No
0 -> 1
Yeah -> Nope
</code>```

and vice versa. Keeping punctuation and the first letter's capitalization counts. Only one condition will be passed to the program.

You only need to accept the following test cases:

```<code>True <-> False
True. <-> False.
true <-> false
true. <-> false.
Yes <-> No
Yes. <-> No.
yes <-> no
yes. <-> no.
0 <-> 1
Yeah <-> Nope
yeah <-> nope
Yeah. <-> Nope.
yeah. <-> nope.
</code>```

This is code-golf, so the shortest answer in bytes wins.

Body:
Emacs Lisp 221 Bytes

(defun g(a b)(when(string-match a s)(throw s(replace-match b'()'()s))))
(defun f(s)(catch s(dolist(l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))(let((a(car l))(d(cdr l))(case-fold-search t))(g a d)(g d a)))))

Ungolfed:

(defun g (a b)
  ;; when a is in s (dynamical scope) throws the replacement string
  (when (string-match a s)
    (throw s (replace-match b nil nil s))))

(defun f (s)
  (catch s ; catch replacement
    (dolist (l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))
      (let ((a(car l))
            (d(cdr l))
            ;; Emacs string-match ignores case, when case-fold-search is true.
            ;; The standard is t, but through customization/local variables
            ;; this can change. Therefore we set it explicitly.
            ;; We could have saved 20 bytes here...
            (case-fold-search t))
        (g a d)
        (g d a)))))

The main "feature" here, is that string-match can be made to ignore case and that replace-match is somewhat intelligent with replacing. For instance, this would also work with TRUE and FALSE. We also exploit dynamical scope to save typing.


问:
golf atan2
Sometimes it really is a struggle to convert Cartesian coordinates (x,y) to Polar coordinates (r,phi). While you can calculate r = sqrt(x^2+y^2) quite easily, you often need some distinction of cases when calculating the angle phi because arcsin,arccos and arctan and all other trigonometric functions have a co-domain that each only spans half the circle.

In many languages there are built-ins for converting rectangular to polar coordinates, or at least have an atan2 function, which - given (x,y) - calculate the angle phi.

Task

Your task is to write a program/function that takes two (floating point, not both zero) Cartesian coordinates (x,y), and outputs the corresponding polar angle phi, where phi has to be in degrees, radians or grades (with grades I mean gradians which are 1/400 of the full circle), whichever is more convenient for you.

The angle is measured in positive orientation, and we have the zero angle for (1,0).

Details

You may not use built-ins that calculate the angle phi given two coordinates, including atan2,rect2polar,argOfComplexNumber and similar functions. However you can use the usual trigonometric functions and their reverses, that only take one argument. Any unit symbols are optional.

The radius r must be non-negative, and phi must be in the range [-360°, 360°] (it does not matter whether you output 270° or -90°).

Examples

```<code>Input       Output
(1,1)       45°
(0,3)       90°
(-1,1)      135°
(-5,0)      180°
(-2,-2)     225°
(0,-1.5)    270°
(4,-5)      308.66°
</code>```

答:
, 13 chars / 17 bytes

```<code>î<0)*π+МǍ í/î
</code>```

Try it here (ES6 browsers only).

Uses (x<0)*pi+tan(y/x).

ContentLicense: CC BY-SA 3.0

Title: golf atan2

Body:
, 13 chars / 17 bytes

î<0)*π+МǍ í/î

Try it here (ES6 browsers only).

Uses (x<0)*pi+tan(y/x).


问:
Reverse the consonants
The program should take a string as input and reverse the consonants in it, while keeping the order of vowels. All the letters will be lowercase, so you don't have to worry about casing. Examples follow.

Input: a test case.

The consonants here are t,s,t,c,s. They should come in reversed order, i.e. s,c,t,s,t and inserted back into the string to the same positions where the pre-reversed characters were located: a sect sate.

Input: well-done. Output: nedl-lowe.

Input: reverse the consonants. Output: setenne sne cohtosarvr.

This is the code golf, the shortest solution wins.

Y should be considered vowel regardless of what it is and not reversed.

Anything, as well as numbers, punctuation, quotes, and other symbols (@#$%^&*(){}[]\|/<>~-_+=`), could potentially appear in the input.

Title: Reverse the consonants

Body:
Mathematica 216 bytes

Module[{h,v,i},v=Characters["aeiouy "];h[s_]:=SortBy[Flatten[Thread/@Transpose@{v,#[[All,1]]&/@(StringPosition[s,#]&/@v)},1],Last];i[s_,{a_,n_}]:=StringInsert[s,a,n];Fold[i,StringReverse@StringReplace[#,v->""],h@#]]&


问:
Settlers of Catan - Longest Road!
This is an endgame board of Settlers of Catan:

Background:

The roads (the long stick pieces) and the settlements (and cities) are rendered by the little huts. We encode the placement of these pieces by using the following scheme: From the top, we have a row horizontal vertices and edges where a road can be placed. Then we have a column of only roads, and so forth. Using R for Red, O for Orange, and B for Blue, and _ for nothing, the pictured board would be encoded as:

```<code>________RR_R_
__R_
__RR_R_RRR_____R_
B___R
_B_________B__OO_OOR_
B__B_R
BB_BBB_____B____RR_R_
OBB_O
OO__BB_BB__OOO_OO
O_O_
_O_OOO_O_____
</code>```

A board like this will be your input string. Any letter [A-Z] may indicate a player color, but there will at most four colors (including empty). Boards are otherwise guaranteed to be valid according to the rules of Settlers, which means:

Each color will have at most two contiguous road networks, which may or may not be broken apart by other players settlements / cities (vertex buildings). See the orange settlement breaking apart the red road on the right side of the sample image.

Each road network is guaranteed to have at least one settlement.

All settlements and cities are guaranteed to be at least two edges from the nearest other settlement / city (yours or otherwise)

One player may only have 15 roads on the game board.

For Catan enthusiasts: there is no distinction between settlements and cities for the purpose of this problem, so I don't distinguish in the input string.

All this is for the specification of the "input" string.

Longest Road:

In Settlers, players get two victory points for having the "longest road". This is defined to be: The longest contiguous single path (measured in roads) from start point to end point, that is not broken up by an opponents settlement or city. Cycles are okay, as long as you can trace the path from one particular start point to one particular end point. So, a loop of 6 roads plus one road branching off is length 7, but one with two branching off the 6 road loop on opposite sides is still only worth 7.

In the example map, the Red road on the right side is only worth 4, because he is cut off by an Orange settlement on the right side of the board (that's why settlements are included at all). Blue has a road of length 13, and Orange has a road of length 12. Red's top road is only worth 7, because it doesn't connect to the two single roads next to it.

Output:

All players that have a road of the longest length (it could be more than one if there are ties), followed by a whitespace and/or underscore delimited count in base 10 of how long that road is.

So the output for the example board would be:

```<code>B 13
</code>```

The Problem statement:

You may write a program or function, receives the input board via STDIN or as a string argument to your function, which returns the output described above as a string or prints it to STDOUT (or closest alternative). You may optionally include a single trailing newline in the output.

This is code-golf, shortest program wins. Standard loopholes are banned, of course.

答:
Python 2, <s>445</s> 400 bytes

I'm a fan of Settlers, so this challenge was fun.

```<code>T="^"
Z=26
A=T*52
for i in range(11):A+=(T*(i%2)*3).join(x for x in raw_input()).center(Z,T)
A+=T*52
def f(c,p=0,l=0,B=A):
 b=l;C=B[0:p]+T+B[p+1:];n=(Z,1)[p%2]
 for i in(p<1)*range(390):
    if(i/Z%2<1&i%2>0)|(i/Z%2>0&i%2<1):b=max(b,f(c,i))
 for i in(p-n,p+n)*(B[p]==c):
    for j in(i-Z,i-1,i+1,i+Z)*(B[i]in c+"_"):b=max(b,f(c,j,l+1,C))
 return b
i=l=0
for x in A:
 if x<T:i=f(x)
 if i>l:c=x;l=i
print c,l
</code>```

Score reflects replacing each occurrence of 4 spaces with a tab.

Explanation

The lines before the function definition read the input, and build a normalized board into a single string variable.  The process inserts "^" characters into the short lines representing the vertical road segments.  It also pads the board with "^" characters.

```<code>^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^________RR_R_^^^^^^^
^^^^^^_^^^_^^^R^^^_^^^^^^^
^^^^__RR_R_RRR_____R_^^^^^
^^^^B^^^_^^^_^^^_^^^R^^^^^
^^_B_________B__OO_OOR_^^^
^^B^^^_^^^_^^^B^^^_^^^R^^^
^^BB_BBB_____B____RR_R_^^^
^^^^O^^^B^^^B^^^_^^^O^^^^^
^^^^OO__BB_BB__OOO_OO^^^^^
^^^^^^O^^^_^^^O^^^_^^^^^^^
^^^^^^_O_OOO_O_____^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
</code>```

When called with the default parameters, the function returns the length of a road of a given color.  The first loop is active only when the position (p) parameter was supplied.  It recursively finds the length of the road at each valid road position, and keeps track of the longest one.  When there is a road at the position parameter, the function recursively adds the length of adjacent roads of the same color.  The road is replaced with a "~" in the working copy of the board to ensure it doesn't recount segments that have already been counted.

The code following the function definition calls the function for each color in the board, and prints the highest scoring color and length.

Demo it here

Title: Settlers of Catan - Longest Road!

Body:
Python 2, <s>445</s> 400 bytes

I'm a fan of Settlers, so this challenge was fun.

T="^"
Z=26
A=T*52
for i in range(11):A+=(T*(i%2)*3).join(x for x in raw_input()).center(Z,T)
A+=T*52
def f(c,p=0,l=0,B=A):
 b=l;C=B[0:p]+T+B[p+1:];n=(Z,1)[p%2]
 for i in(p<1)*range(390):
    if(i/Z%2<1&i%2>0)|(i/Z%2>0&i%2<1):b=max(b,f(c,i))
 for i in(p-n,p+n)*(B[p]==c):
    for j in(i-Z,i-1,i+1,i+Z)*(B[i]in c+"_"):b=max(b,f(c,j,l+1,C))
 return b
i=l=0
for x in A:
 if x<T:i=f(x)
 if i>l:c=x;l=i
print c,l

Score reflects replacing each occurrence of 4 spaces with a tab.

Explanation

The lines before the function definition read the input, and build a normalized board into a single string variable.  The process inserts "^" characters into the short lines representing the vertical road segments.  It also pads the board with "^" characters.

^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^________RR_R_^^^^^^^
^^^^^^_^^^_^^^R^^^_^^^^^^^
^^^^__RR_R_RRR_____R_^^^^^
^^^^B^^^_^^^_^^^_^^^R^^^^^
^^_B_________B__OO_OOR_^^^
^^B^^^_^^^_^^^B^^^_^^^R^^^
^^BB_BBB_____B____RR_R_^^^
^^^^O^^^B^^^B^^^_^^^O^^^^^
^^^^OO__BB_BB__OOO_OO^^^^^
^^^^^^O^^^_^^^O^^^_^^^^^^^
^^^^^^_O_OOO_O_____^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^

When called with the default parameters, the function returns the length of a road of a given color.  The first loop is active only when the position (p) parameter was supplied.  It recursively finds the length of the road at each valid road position, and keeps track of the longest one.  When there is a road at the position parameter, the function recursively adds the length of adjacent roads of the same color.  The road is replaced with a "~" in the working copy of the board to ensure it doesn't recount segments that have already been counted.

The code following the function definition calls the function for each color in the board, and prints the highest scoring color and length.

Demo it here


问:
Wait a minute – in less than ten seconds

Task

Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half).

The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total executed sleep time. Both time values have to have a precision of at least 0.1 seconds.

This is similar to the concept of man-hours: a job that takes 60 hours can be completed in only 6 hours if 10 workers are splitting the job. Here we can have 60 seconds of sleep time e.g. in 10 parallel threads, thus requiring only 6 seconds for the whole job to be completed.

Example

The program MyProgram creates 14 threads, each thread sleeps for 5 seconds:

MyProgram → [5.016,70.105]

The execution time is greater than 5 seconds, and the total sleep time is greater than 70 seconds because of overhead.

答:
Scratch - 164 bytes (16 blocks)

```<code>when gf clicked
set[t v]to[
repeat(9
  create clone of[s v
end
wait until<(t)>[60
say(join(join(t)[ ])(timer
when I start as a clone
wait(8)secs
change[t v]by(timer
</code>```

See it in action here.

Uses a variable called 't' and a sprite called 's'. The sprite creates clones of itself, each of which waits 8 seconds, and increments a variable clocking the entire wait time. At the end it says the total execution time and the total wait time (for example, 65.488 8.302).

Body:
Scratch - 164 bytes (16 blocks)

when gf clicked
set[t v]to[
repeat(9
  create clone of[s v
end
wait until<(t)>[60
say(join(join(t)[ ])(timer
when I start as a clone
wait(8)secs
change[t v]by(timer

See it in action here.

Uses a variable called 't' and a sprite called 's'. The sprite creates clones of itself, each of which waits 8 seconds, and increments a variable clocking the entire wait time. At the end it says the total execution time and the total wait time (for example, 65.488 8.302).


答:
Python 3, 65 bytes

```<code>from math import*
f=lambda x,y:atan(y/x if x else y*inf)+pi*(x<0)
</code>```

This outputs radians in the range [-π/2, 3π/2), equivalent to [-90, 270) degrees.

Title: golf atan2

Body:
Sometimes it really is a struggle to convert Cartesian coordinates (x,y) to Polar coordinates (r,phi). While you can calculate r = sqrt(x^2+y^2) quite easily, you often need some distinction of cases when calculating the angle phi because arcsin,arccos and arctan and all other trigonometric functions have a co-domain that each only spans half the circle.

In many languages there are built-ins for converting rectangular to polar coordinates, or at least have an atan2 function, which - given (x,y) - calculate the angle phi.

Task

Your task is to write a program/function that takes two (floating point, not both zero) Cartesian coordinates (x,y), and outputs the corresponding polar angle phi, where phi has to be in degrees, radians or grades (with grades I mean gradians which are 1/400 of the full circle), whichever is more convenient for you.

The angle is measured in positive orientation, and we have the zero angle for (1,0).

Details

You may not use built-ins that calculate the angle phi given two coordinates, including atan2,rect2polar,argOfComplexNumber and similar functions. However you can use the usual trigonometric functions and their reverses, that only take one argument. Any unit symbols are optional.

The radius r must be non-negative, and phi must be in the range [-360°, 360°] (it does not matter whether you output 270° or -90°).

Examples

```<code>Input       Output
(1,1)       45°
(0,3)       90°
(-1,1)      135°
(-5,0)      180°
(-2,-2)     225°
(0,-1.5)    270°
(4,-5)      308.66°
</code>```

Body:
Python 3, 65 bytes

from math import*
f=lambda x,y:atan(y/x if x else y*inf)+pi*(x<0)

This outputs radians in the range [-π/2, 3π/2), equivalent to [-90, 270) degrees.


问:
Image Hide-and-Seek
In this challenge, you need to find a specific pixel within an photograph (taken with a real camera).

You are passed an (R, G, B) tuple and an image, and you need to return a point (x,y) within the image that matches the RGB color given.  The image may have multiple points that match the color; you only need to find 1.

The challenge is that you need to do it while reading as few pixels as possible.  Your score will be total number of pixels read across all test cases.

If you wish, you can read the entire image into an array of RGB values, as long as you don't do any processing on the pixels.  I allow this purely for efficiency purposes.  For example, in Python, list(Image.open("image_name+".jpg").convert("RGB").getdata()) is ok.

Hardcoding locations is not allowed.  Your algorithm should work well for more than just the test cases listed below.  You are not allowed to save data between test cases.  I've chosen RGB values that appear infrequently (<10) in the image (in case that makes a difference for your algorithm).  If you are using randomness in your algorithm, please set a seed, so that your score is constant.

Images can be found on Github

Test cases:

```<code>image_name:
(r, g, b) [all possible answers]

barn:
(143,91,33) [(887,1096),(2226,1397),(2007,1402),(2161,1508),(1187,1702)]
(53,35,59) [(1999,1260)]
(20,24,27) [(1328,1087),(154,1271)]
(167,148,176) [(1748,1204)]
(137,50,7) [(596,1498)]
(116,95,94) [(1340,1123)]
(72,49,59) [(1344,857),(1345,858),(1380,926),(1405,974),(1480,1117)]
(211,163,175) [(1963,745)]
(30,20,0) [(1609,1462),(1133,1477),(1908,1632)]
(88,36,23) [(543,1494),(431,1575)]
daisy:
(21,57,91) [(1440,1935),(2832,2090),(2232,2130),(1877,2131),(1890,2132)]
(201,175,140) [(1537,1749),(2319,1757)]
(169,160,0) [(2124,759)]
(113,123,114) [(1012,994),(2134,1060),(1803,1183),(1119,1335)]
(225,226,231) [(3207,829),(3256,889),(3257,889),(1434,981),(2599,1118),(2656,1348),(2656,1351)]
(17,62,117) [(2514,3874),(2336,3885)]
(226,225,204) [(3209,812)]
(119,124,146) [(2151,974),(2194,1021),(2194,1022),(2202,1034),(2812,1500)]
(2,63,120) [(2165,3881),(2326,3882),(2330,3882),(2228,3887)]
(200,167,113) [(1453,1759)]
dandelion:
(55,2,46) [(667,825),(668,825)]
(95,37,33) [(1637,1721),(1625,1724),(1405,1753),(2026,2276),(2016,2298)]
(27,41,50) [(1267,126),(424,519),(2703,1323),(1804,3466)]
(58,92,129) [(2213,3274)]
(136,159,105) [(1300,2363),(2123,2645),(1429,3428),(1430,3432),(1417,3467),(1393,3490),(1958,3493)]
(152,174,63) [(2256,2556)]
(78,49,19) [(2128,2836)]
(217,178,205) [(2736,3531)]
(69,95,130) [(870,305),(493,460),(2777,1085),(2791,1292),(2634,3100)]
(150,171,174) [(2816,1201),(2724,2669),(1180,2706),(1470,3215),(1471,3215)]
gerbera:
(218,186,171) [(4282,1342)]
(180,153,40) [(4596,1634),(4369,1682),(4390,1708),(4367,1750)]
(201,179,119) [(4282,1876),(4479,1928)]
(116,112,149) [(5884,252),(4168,371),(4169,372),(4164,384),(5742,576)]
(222,176,65) [(4232,1548)]
(108,129,156) [(5341,3574),(5339,3595),(5302,3734)]
(125,99,48) [(4548,1825),(4136,1932),(5054,2013),(5058,2023),(5058,2035),(5055,2050),(5031,2073)]
(170,149,32) [(4461,1630),(4520,1640)]
(156,185,203) [(3809,108)]
(103,67,17) [(4844,1790)]
hot-air:
(48,21,36) [(1992,1029),(2005,1030),(2015,1034),(2018,1036)]
(104,65,36) [(3173,1890),(3163,1893)]
(169,89,62) [(4181,931),(4210,938),(4330,1046),(4171,1056),(3117,1814)]
(68,59,60) [(1872,220),(1874,220),(1878,220),(1696,225),(3785,429)]
(198,96,74) [(4352,1057)]
(136,43,53) [(1700,931)]
(82,42,32) [(4556,961),(4559,973),(4563,989),(4563,990),(4441,1004),(4387,1126),(4378,1128)]
(192,132,72) [(1399,900),(3105,1822),(3104,1824),(3105,1824),(3107,1826),(3107,1827),(3104,1839),(3119,1852)]
(146,21,63) [(1716,993)]
(125,64,36) [(4332,937)]
in-input:
(204,90,1) [(1526,1997),(1385,2145),(4780,2807),(4788,3414)]
(227,163,53) [(1467,1739),(2414,1925),(2441,2198),(134,2446)]
(196,179,135) [(3770,2740),(1110,3012),(3909,3216),(1409,3263),(571,3405)]
(208,59,27) [(1134,1980),(4518,2108),(4515,2142)]
(149,70,1) [(4499,1790),(2416,2042),(1338,2150),(3731,2408),(3722,2409),(4400,3618)]
(168,3,7) [(987,402),(951,432),(1790,1213),(1790,1214),(1848,1217),(4218,1840),(4344,1870),(1511,1898)]
(218,118,4) [(3857,1701),(1442,1980),(1411,2156),(25,2606)]
(127,153,4) [(3710,2813)]
(224,230,246) [(2086,160),(2761,222),(4482,1442)]
(213,127,66) [(4601,1860),(4515,2527),(4757,2863)]
klatschmohn:
(170,133,19) [(1202,2274),(1202,2275),(957,2493),(1034,2633),(3740,3389),(3740,3391),(3683,3439)]
(162,92,4) [(489,2854)]
(159,175,104) [(3095,2475),(3098,2481)]
(199,139,43) [(1956,3055)]
(171,169,170) [(3669,1487),(3674,1490),(3701,1507)]
(184,115,58) [(1958,2404)]
(228,169,5) [(1316,2336),(1317,2336)]
(179,165,43) [(3879,2380),(1842,2497),(1842,2498)]
(67,21,6) [(1959,2197),(2157,2317),(2158,2317),(2158,2318),(2116,2373)]
(213,100,106) [(1303,1816)]
tajinaste-rojo:
(243,56,99) [(1811,2876),(1668,4141),(2089,4518),(1981,4732),(1659,4778),(2221,5373),(1779,5598),(2210,5673),(2373,5860)]
(147,157,210) [(1835,1028),(1431,3358)]
(114,37,19) [(1792,3572),(1818,3592)]
(108,117,116) [(2772,4722),(1269,5672),(2512,5811),(2509,5830),(2186,5842),(2186,5846),(2190,5851),(2211,5884)]
(214,197,93) [(1653,4386)]
(163,102,101) [(2226,2832),(2213,3683),(1894,4091),(1875,4117)]
(192,192,164) [(2175,2962),(2206,3667),(2315,3858),(1561,3977),(3039,5037),(3201,5641)]
(92,118,45) [(1881,1704),(1983,1877),(2254,2126),(3753,5862),(3766,5883)]
(145,180,173) [(1826,1585)]
(181,124,105) [(1969,3892)]
turret-arch:
(116,70,36) [(384,648),(516,669)]
(121,115,119) [(2419,958)]
(183,222,237) [(172,601),(183,601),(110,611),(111,617)]
(237,136,82) [(2020,282),(676,383),(748,406),(854,482),(638,497),(647,661),(1069,838),(1809,895),(1823,911)]
(193,199,215) [(1567,919),(1793,1047)]
(33,30,25) [(1307,861),(309,885),(1995,895),(504,1232),(2417,1494)]
(17,23,39) [(1745,1033),(788,1090),(967,1250)]
(192,139,95) [(1445,1337)]
(176,125,98) [(1197,1030)]
(178,83,0) [(2378,1136)]
water-lilies:
(86,140,80) [(2322,2855),(4542,3005),(4540,3006),(4577,3019)]
(218,124,174) [(1910,2457)]
(191,77,50) [(2076,1588)]
(197,211,186) [(4402,1894)]
(236,199,181) [(2154,1836)]
(253,242,162) [(1653,1430)]
(114,111,92) [(1936,2499)]
(111,93,27) [(2301,2423),(2127,2592),(2137,2717),(2147,2717)]
(139,92,102) [(1284,2243),(1297,2258)]
(199,157,117) [(3096,993)]
</code>```

答:
Python, score: 14,035,624

First thing's first, here's the code:

from heapq import heappush, heappop
from PIL import Image
import random

random.seed(1)

def dist(x, y):
    return sum([(x[i] - y[i]) ** 2 for i in range(3)])

def gradient_descent(image_name, c):
    im = Image.open(image_name + '.jpg').convert('RGB')
    L = im.load()
    sx, sy = im.size
    heap = []
    visited = set()
    count = 0
    points = []
    for i in range(0, sx, sx / 98):
        for j in range(0, sy, sy / 98):
            points.append((i, j))
    for x in points:
        heappush(heap, [dist(c, L[x[0], x[1]]), [x[0], x[1]]])
        visited.add((x[0], x[1]))

    while heap:
        if count % 10 == 0:
            x = random.random()
            if x < 0.5:
                n = heap.pop(random.randint(10, 100))
            else:
                n = heappop(heap)
        else:
            n = heappop(heap)
        x, y = n[1]
        c_color = L[x, y]
        count += 1

        if c_color == c:
            p = float(len(visited)) / (sx * sy) * 100
            print('count: {}, percent: {}, position: {}'.format(len(visited), p, (x, y)))
            return len(visited)

        newpoints = []
        newpoints.append((x + 1, y))
        newpoints.append((x - 1, y))
        newpoints.append((x, y + 1))
        newpoints.append((x, y - 1))
        newpoints.append((x + 1, y + 1))
        newpoints.append((x + 1, y - 1))
        newpoints.append((x - 1, y + 1))
        newpoints.append((x - 1, y - 1))

        for p in newpoints:
            if p not in visited:
                try:
                    d = dist(c, L[p[0], p[1]])
                    heappush(heap, [d, [p[0], p[1]]])
                    visited.add(p)
                except IndexError:
                    pass
```

<p>and here's a gif showing how the algorithm examines pixels:
<img src="https://github.com/Eppie/image-hide-and-seek/blob/master/gifs/water-lilies_197_211_186.gif?raw=true"></p>

<p>So, here's what this code is doing: The variable <code>heap</code> is a priority queue of <code>(x, y)</code> coordinates in the image, sorted by the Euclidean distance of the color at that coordinate to the target color. It gets initialized with 10,200 points which are evenly distributed across the entire image.</p>

<p>With the heap initialized, we then pop off the point with the minimum distance to the target color. If the color at that point has a distance > 0, that is to say, if the color at that point is NOT the target color, we add the 8 surrounding points from it to <code>heap</code>. To ensure that a given point isn't considered more than once, we maintain the variable <code>visited</code>, which is a set of all the points that have been examined so far.</p>

<p>Occasionally, instead of directly taking the point with the minimum color distance, we'll randomly choose some other point from <em>near</em> the top of the queue. This isn't strictly necessary, but in my testing, it shaves off approximately 1,000,000 pixels from the total score. Once the target color is found, we simply return the length of the <code>visited</code> set.</p>

<p>Like @Karl Napf, I ignored the test cases where the specified color was not present in the image. You can find a driver program to run through all the test cases at the GitHub repository I created for this answer.</p>

<p>Here are the results from each specific test case:</p>

```barn
color: (143, 91, 33), count: 20388 / 0.452483465755%, position: (612, 1131)
color: (53, 35, 59), count: 99606 / 2.21061742643%, position: (1999, 1260)
color: (72, 49, 59), count: 705215 / 15.6512716943%, position: (1405, 974)

daisy
color: (21, 57, 91), count: 37393 / 0.154770711039%, position: (1877, 2131)
color: (169, 160, 0), count: 10659 / 0.0441179100089%, position: (2124, 759)
color: (113, 123, 114), count: 674859 / 2.79326096545%, position: (1119, 1335)
color: (225, 226, 231), count: 15905 / 0.0658312560927%, position: (3256, 889)
color: (17, 62, 117), count: 15043 / 0.0622634131029%, position: (2514, 3874)
color: (226, 225, 204), count: 138610 / 0.573710808362%, position: (1978, 1179)
color: (119, 124, 146), count: 390486 / 1.61623287435%, position: (2357, 917)
color: (2, 63, 120), count: 10063 / 0.0416510487306%, position: (2324, 3882)
color: (200, 167, 113), count: 16393 / 0.06785110224%, position: (1453, 1759)

dandelion
color: (95, 37, 33), count: 10081 / 0.0686342592593%, position: (1625, 1724)
color: (27, 41, 50), count: 2014910 / 13.7180691721%, position: (1267, 126)
color: (58, 92, 129), count: 48181 / 0.328029684096%, position: (1905, 756)
color: (136, 159, 105), count: 10521 / 0.0716299019608%, position: (1416, 3467)
color: (152, 174, 63), count: 10027 / 0.0682666122004%, position: (2256, 2558)
color: (69, 95, 130), count: 201919 / 1.37472086057%, position: (2708, 2943)
color: (150, 171, 174), count: 29714 / 0.202301198257%, position: (1180, 2706)

gerbera
color: (180, 153, 40), count: 21904 / 0.0906612910062%, position: (4459, 1644)
color: (116, 112, 149), count: 14896 / 0.0616549758413%, position: (5884, 252)
color: (222, 176, 65), count: 76205 / 0.315414704215%, position: (4313, 2097)
color: (108, 129, 156), count: 12273 / 0.0507983027994%, position: (5302, 3734)
color: (125, 99, 48), count: 26968 / 0.111621333814%, position: (5054, 2013)
color: (170, 149, 32), count: 89591 / 0.370819746281%, position: (4478, 1647)
color: (156, 185, 203), count: 177373 / 0.734151989118%, position: (4096, 368)
color: (103, 67, 17), count: 11035 / 0.0456741849093%, position: (4844, 1790)

hot-air
color: (48, 21, 36), count: 49711 / 0.24902994992%, position: (1990, 1095)
color: (104, 65, 36), count: 9927 / 0.0497298447599%, position: (3191, 1846)
color: (68, 59, 60), count: 195418 / 0.978957066918%, position: (3948, 470)
color: (82, 42, 32), count: 12216 / 0.0611967143737%, position: (4559, 984)
color: (192, 132, 72), count: 116511 / 0.583668171938%, position: (3103, 1844)

in-input
color: (204, 90, 1), count: 44058 / 0.248299807393%, position: (4695, 2559)
color: (227, 163, 53), count: 12654 / 0.0713147615132%, position: (221, 2384)
color: (196, 179, 135), count: 181534 / 1.02307996812%, position: (1030, 3486)
color: (208, 59, 27), count: 9956 / 0.0561095120614%, position: (4518, 2108)
color: (149, 70, 1), count: 13698 / 0.0771984829467%, position: (3731, 2408)
color: (168, 3, 7), count: 19381 / 0.10922644167%, position: (942, 398)
color: (218, 118, 4), count: 36648 / 0.206538911011%, position: (25, 2606)
color: (224, 230, 246), count: 1076427 / 6.06647185011%, position: (4482, 1442)
color: (213, 127, 66), count: 62673 / 0.353209265712%, position: (4701, 2579)

klatschmohn
color: (170, 133, 19), count: 11535 / 0.0724321530189%, position: (1034, 2633)
color: (162, 92, 4), count: 103795 / 0.651763790429%, position: (489, 2854)
color: (159, 175, 104), count: 10239 / 0.0642941321856%, position: (3098, 2481)
color: (171, 169, 170), count: 10119 / 0.063540611738%, position: (3674, 1490)
color: (184, 115, 58), count: 22425 / 0.140814133632%, position: (1958, 2404)
color: (228, 169, 5), count: 10449 / 0.0656127929688%, position: (1316, 2336)
color: (179, 165, 43), count: 10285 / 0.0645829816905%, position: (1842, 2498)
color: (67, 21, 6), count: 10206 / 0.0640869140625%, position: (2116, 2373)
color: (213, 100, 106), count: 11712 / 0.073543595679%, position: (1303, 1816)

tajinaste-rojo
color: (243, 56, 99), count: 126561 / 0.5273375%, position: (2241, 5424)
color: (114, 37, 19), count: 11285 / 0.0470208333333%, position: (1818, 3583)
color: (108, 117, 116), count: 33855 / 0.1410625%, position: (1269, 5672)
color: (163, 102, 101), count: 1058090 / 4.40870833333%, position: (1546, 4867)
color: (192, 192, 164), count: 10118 / 0.0421583333333%, position: (1919, 3171)
color: (92, 118, 45), count: 13431 / 0.0559625%, position: (3766, 5883)
color: (145, 180, 173), count: 1207713 / 5.0321375%, position: (1863, 955)

turret-arch
color: (116, 70, 36), count: 145610 / 3.23161258822%, position: (96, 671)
color: (183, 222, 237), count: 11704 / 0.259754094722%, position: (140, 604)
color: (237, 136, 82), count: 60477 / 1.34220338231%, position: (1063, 993)
color: (193, 199, 215), count: 359671 / 7.98240046163%, position: (2259, 953)
color: (33, 30, 25), count: 148195 / 3.28898308846%, position: (1307, 861)
color: (17, 23, 39), count: 10601 / 0.235274535044%, position: (2080, 1097)
color: (192, 139, 95), count: 219732 / 4.87664787607%, position: (1127, 970)
color: (176, 125, 98), count: 2471787 / 54.8578942696%, position: (147, 734)

water-lilies
color: (86, 140, 80), count: 10371 / 0.0717376936238%, position: (4542, 3005)
color: (218, 124, 174), count: 25655 / 0.177459312498%, position: (1910, 2457)
color: (197, 211, 186), count: 1144341 / 7.91557073177%, position: (4402, 1894)
color: (253, 242, 162), count: 14174 / 0.0980435897622%, position: (1672, 1379)
color: (111, 93, 27), count: 10405 / 0.0719728764975%, position: (2147, 2717)
color: (199, 157, 117), count: 10053 / 0.0695380420403%, position: (3096, 993)

Total: 14035624
```

Title: Image Hide-and-Seek

Body:
Python, score: 14,035,624

First thing's first, here's the code:

from heapq import heappush, heappop
from PIL import Image
import random

random.seed(1)

def dist(x, y):
    return sum([(x[i] - y[i]) ** 2 for i in range(3)])

def gradient_descent(image_name, c):
    im = Image.open(image_name + '.jpg').convert('RGB')
    L = im.load()
    sx, sy = im.size
    heap = []
    visited = set()
    count = 0
    points = []
    for i in range(0, sx, sx / 98):
        for j in range(0, sy, sy / 98):
            points.append((i, j))
    for x in points:
        heappush(heap, [dist(c, L[x[0], x[1]]), [x[0], x[1]]])
        visited.add((x[0], x[1]))

    while heap:
        if count % 10 == 0:
            x = random.random()
            if x < 0.5:
                n = heap.pop(random.randint(10, 100))
            else:
                n = heappop(heap)
        else:
            n = heappop(heap)
        x, y = n[1]
        c_color = L[x, y]
        count += 1

        if c_color == c:
            p = float(len(visited)) / (sx * sy) * 100
            print('count: {}, percent: {}, position: {}'.format(len(visited), p, (x, y)))
            return len(visited)

        newpoints = []
        newpoints.append((x + 1, y))
        newpoints.append((x - 1, y))
        newpoints.append((x, y + 1))
        newpoints.append((x, y - 1))
        newpoints.append((x + 1, y + 1))
        newpoints.append((x + 1, y - 1))
        newpoints.append((x - 1, y + 1))
        newpoints.append((x - 1, y - 1))

        for p in newpoints:
            if p not in visited:
                try:
                    d = dist(c, L[p[0], p[1]])
                    heappush(heap, [d, [p[0], p[1]]])
                    visited.add(p)
                except IndexError:
                    pass

and here's a gif showing how the algorithm examines pixels:

So, here's what this code is doing: The variable heap is a priority queue of (x, y) coordinates in the image, sorted by the Euclidean distance of the color at that coordinate to the target color. It gets initialized with 10,200 points which are evenly distributed across the entire image.

With the heap initialized, we then pop off the point with the minimum distance to the target color. If the color at that point has a distance > 0, that is to say, if the color at that point is NOT the target color, we add the 8 surrounding points from it to heap. To ensure that a given point isn't considered more than once, we maintain the variable visited, which is a set of all the points that have been examined so far.

Occasionally, instead of directly taking the point with the minimum color distance, we'll randomly choose some other point from near the top of the queue. This isn't strictly necessary, but in my testing, it shaves off approximately 1,000,000 pixels from the total score. Once the target color is found, we simply return the length of the visited set.

Like @Karl Napf, I ignored the test cases where the specified color was not present in the image. You can find a driver program to run through all the test cases at the GitHub repository I created for this answer.

Here are the results from each specific test case:

barn
color: (143, 91, 33), count: 20388 / 0.452483465755%, position: (612, 1131)
color: (53, 35, 59), count: 99606 / 2.21061742643%, position: (1999, 1260)
color: (72, 49, 59), count: 705215 / 15.6512716943%, position: (1405, 974)

daisy
color: (21, 57, 91), count: 37393 / 0.154770711039%, position: (1877, 2131)
color: (169, 160, 0), count: 10659 / 0.0441179100089%, position: (2124, 759)
color: (113, 123, 114), count: 674859 / 2.79326096545%, position: (1119, 1335)
color: (225, 226, 231), count: 15905 / 0.0658312560927%, position: (3256, 889)
color: (17, 62, 117), count: 15043 / 0.0622634131029%, position: (2514, 3874)
color: (226, 225, 204), count: 138610 / 0.573710808362%, position: (1978, 1179)
color: (119, 124, 146), count: 390486 / 1.61623287435%, position: (2357, 917)
color: (2, 63, 120), count: 10063 / 0.0416510487306%, position: (2324, 3882)
color: (200, 167, 113), count: 16393 / 0.06785110224%, position: (1453, 1759)

dandelion
color: (95, 37, 33), count: 10081 / 0.0686342592593%, position: (1625, 1724)
color: (27, 41, 50), count: 2014910 / 13.7180691721%, position: (1267, 126)
color: (58, 92, 129), count: 48181 / 0.328029684096%, position: (1905, 756)
color: (136, 159, 105), count: 10521 / 0.0716299019608%, position: (1416, 3467)
color: (152, 174, 63), count: 10027 / 0.0682666122004%, position: (2256, 2558)
color: (69, 95, 130), count: 201919 / 1.37472086057%, position: (2708, 2943)
color: (150, 171, 174), count: 29714 / 0.202301198257%, position: (1180, 2706)

gerbera
color: (180, 153, 40), count: 21904 / 0.0906612910062%, position: (4459, 1644)
color: (116, 112, 149), count: 14896 / 0.0616549758413%, position: (5884, 252)
color: (222, 176, 65), count: 76205 / 0.315414704215%, position: (4313, 2097)
color: (108, 129, 156), count: 12273 / 0.0507983027994%, position: (5302, 3734)
color: (125, 99, 48), count: 26968 / 0.111621333814%, position: (5054, 2013)
color: (170, 149, 32), count: 89591 / 0.370819746281%, position: (4478, 1647)
color: (156, 185, 203), count: 177373 / 0.734151989118%, position: (4096, 368)
color: (103, 67, 17), count: 11035 / 0.0456741849093%, position: (4844, 1790)

hot-air
color: (48, 21, 36), count: 49711 / 0.24902994992%, position: (1990, 1095)
color: (104, 65, 36), count: 9927 / 0.0497298447599%, position: (3191, 1846)
color: (68, 59, 60), count: 195418 / 0.978957066918%, position: (3948, 470)
color: (82, 42, 32), count: 12216 / 0.0611967143737%, position: (4559, 984)
color: (192, 132, 72), count: 116511 / 0.583668171938%, position: (3103, 1844)

in-input
color: (204, 90, 1), count: 44058 / 0.248299807393%, position: (4695, 2559)
color: (227, 163, 53), count: 12654 / 0.0713147615132%, position: (221, 2384)
color: (196, 179, 135), count: 181534 / 1.02307996812%, position: (1030, 3486)
color: (208, 59, 27), count: 9956 / 0.0561095120614%, position: (4518, 2108)
color: (149, 70, 1), count: 13698 / 0.0771984829467%, position: (3731, 2408)
color: (168, 3, 7), count: 19381 / 0.10922644167%, position: (942, 398)
color: (218, 118, 4), count: 36648 / 0.206538911011%, position: (25, 2606)
color: (224, 230, 246), count: 1076427 / 6.06647185011%, position: (4482, 1442)
color: (213, 127, 66), count: 62673 / 0.353209265712%, position: (4701, 2579)

klatschmohn
color: (170, 133, 19), count: 11535 / 0.0724321530189%, position: (1034, 2633)
color: (162, 92, 4), count: 103795 / 0.651763790429%, position: (489, 2854)
color: (159, 175, 104), count: 10239 / 0.0642941321856%, position: (3098, 2481)
color: (171, 169, 170), count: 10119 / 0.063540611738%, position: (3674, 1490)
color: (184, 115, 58), count: 22425 / 0.140814133632%, position: (1958, 2404)
color: (228, 169, 5), count: 10449 / 0.0656127929688%, position: (1316, 2336)
color: (179, 165, 43), count: 10285 / 0.0645829816905%, position: (1842, 2498)
color: (67, 21, 6), count: 10206 / 0.0640869140625%, position: (2116, 2373)
color: (213, 100, 106), count: 11712 / 0.073543595679%, position: (1303, 1816)

tajinaste-rojo
color: (243, 56, 99), count: 126561 / 0.5273375%, position: (2241, 5424)
color: (114, 37, 19), count: 11285 / 0.0470208333333%, position: (1818, 3583)
color: (108, 117, 116), count: 33855 / 0.1410625%, position: (1269, 5672)
color: (163, 102, 101), count: 1058090 / 4.40870833333%, position: (1546, 4867)
color: (192, 192, 164), count: 10118 / 0.0421583333333%, position: (1919, 3171)
color: (92, 118, 45), count: 13431 / 0.0559625%, position: (3766, 5883)
color: (145, 180, 173), count: 1207713 / 5.0321375%, position: (1863, 955)

turret-arch
color: (116, 70, 36), count: 145610 / 3.23161258822%, position: (96, 671)
color: (183, 222, 237), count: 11704 / 0.259754094722%, position: (140, 604)
color: (237, 136, 82), count: 60477 / 1.34220338231%, position: (1063, 993)
color: (193, 199, 215), count: 359671 / 7.98240046163%, position: (2259, 953)
color: (33, 30, 25), count: 148195 / 3.28898308846%, position: (1307, 861)
color: (17, 23, 39), count: 10601 / 0.235274535044%, position: (2080, 1097)
color: (192, 139, 95), count: 219732 / 4.87664787607%, position: (1127, 970)
color: (176, 125, 98), count: 2471787 / 54.8578942696%, position: (147, 734)

water-lilies
color: (86, 140, 80), count: 10371 / 0.0717376936238%, position: (4542, 3005)
color: (218, 124, 174), count: 25655 / 0.177459312498%, position: (1910, 2457)
color: (197, 211, 186), count: 1144341 / 7.91557073177%, position: (4402, 1894)
color: (253, 242, 162), count: 14174 / 0.0980435897622%, position: (1672, 1379)
color: (111, 93, 27), count: 10405 / 0.0719728764975%, position: (2147, 2717)
color: (199, 157, 117), count: 10053 / 0.0695380420403%, position: (3096, 993)

Total: 14035624


问:
Fibonacci + Fizz Buzz = Fibo Nacci!
Fibonacci + FizzBuzz = Fibo Nacci!

Your challenge is to create a Fibo Nacci program!

A Fibo Nacci program outputs the first 100 Fibonacci numbers (starting from 1).

If the Fibonacci number is divisible by both 2 and 3 (i.e. it is divisible by 6), then output FiboNacci instead of the number.

Otherwise, if the Fibonacci number is divisible by 2, then output Fibo instead of the number.

Otherwise, if the Fibonacci number is divisible by 3, then output Nacci instead of the number.

Rules

The program should take no input.

The program should output a new line (\n) after every entry.

The program should not print anything to STDERR.

The program must output the first 100 Fibo Nacci entries (starting from 1).

Standard loopholes are not allowed (by default).

This is code-golf so shortest code in bytes wins!

Here is the expected output:

```<code>1
1
Fibo
Nacci
5
Fibo
13
Nacci
Fibo
55
89
FiboNacci
233
377
Fibo
Nacci
1597
Fibo
4181
Nacci
Fibo
17711
28657
FiboNacci
75025
121393
Fibo
Nacci
514229
Fibo
1346269
Nacci
Fibo
5702887
9227465
FiboNacci
24157817
39088169
Fibo
Nacci
165580141
Fibo
433494437
Nacci
Fibo
1836311903
2971215073
FiboNacci
7778742049
12586269025
Fibo
Nacci
53316291173
Fibo
139583862445
Nacci
Fibo
591286729879
956722026041
FiboNacci
2504730781961
4052739537881
Fibo
Nacci
17167680177565
Fibo
44945570212853
Nacci
Fibo
190392490709135
308061521170129
FiboNacci
806515533049393
1304969544928657
Fibo
Nacci
5527939700884757
Fibo
14472334024676221
Nacci
Fibo
61305790721611591
99194853094755497
FiboNacci
259695496911122585
420196140727489673
Fibo
Nacci
1779979416004714189
Fibo
4660046610375530309
Nacci
Fibo
19740274219868223167
31940434634990099905
FiboNacci
83621143489848422977
135301852344706746049
Fibo
Nacci
</code>```

The Catalogue

The <s>Snack</s> Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 63442; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 41805; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Title: Fibonacci + Fizz Buzz = Fibo Nacci!

Body:
///, 642 bytes

/A/
Fibo//B/
Nacci//*/ANacci
//^/AB
/1
1^5A
13BA
55
89*233
377^1597A
4181BA
17711
28657*75025
121393^514229A
1346269BA
5702887
9227465*24157817
39088169^165580141A
433494437BA
1836311903
2971215073*7778742049
12586269025^53316291173A
139583862445BA
591286729879
956722026041*2504730781961
4052739537881^17167680177565A
44945570212853BA
190392490709135
308061521170129*806515533049393
1304969544928657^5527939700884757A
14472334024676221BA
61305790721611591
99194853094755497*259695496911122585
420196140727489673^1779979416004714189A
4660046610375530309BA
19740274219868223167
31940434634990099905*83621143489848422977
135301852344706746049AB


问:
Convolve integers in subquadratic time
An linear discrete convolution is an operation that turns two vectors of numbers into a third vector of numbers by multiplying elements inside-out. Formally, for two vectors a and b with elements 0 to n - 1, the discrete linear convolution of a and b can be computed with this loop:

```<code>for i = 0 to 2*n - 2
    c[i] = 0;
    for j = 0 to n - 1
        if i - j >= 0 and i - j < n
            c[i] = c[i] + a[j] * b[i - j];
</code>```

As an example, the convolution of a = { 1, 2, 3, 4 } and b = { 5, 6, 7, 8 } is c = { 5, 16, 34, 60, 61, 52, 32 }.
These convolutions appear when doing long multiplication, for example:

```<code>1234 * 5678 =
         20 24 28 32
      15 18 21 24
   10 12 14 16
 5  6  7  8
--------------------
 5 16 34 60 61 52 32
--------------------
      32
     52
    61
   60
  34
 16
 5
--------------------
 7006652
</code>```

Your task is to write a program or function that, given two arrays (or similar) a and b of non-negative integers of equal length n and optionally, n and an output array c, computes the linear discrete convolution of a and b and returns it, assigns it to the parameter c. or prints it out. You may also take input from the user while or before your code is running. The following constraints apply:

Your program must run in subquadratic or o(n 2) time. An algorithm like the pseudo-code above that runs in quadratic time Θ(n 2) is invalid.

You may assume that all integers in in- and output are in the range from 0 to 65535, this also applies to n.

You may not claim that your algorithm runs in subquadratic time because n has an upper bound.

The results must be exact.

This is code golf, the shortest code in octets wins.

You may not use existing library routines or similar to compute a Fourier transform or a number theoretic transform or the respective inverse transformations.

答:
J, 79 bytes, O(n log n)

```<code>f=:_2&(0((+,-)]%_1^i.@#%#)&f/@|:]\)~1<#
<:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#
</code>```

Uses the Convolution theorem which states that the Fourier transform of the convolution of two sequences is equal to the Fourier transform of each sequence multiplied together elementwise.

```<code>Fourier( Convolve(a, b) ) = Fourier(a) * Fourier(b)
Convolve(a, b) = InverseFourier( Fourier(a) * Fourier(b) )
</code>```

Also uses the fact the the inverse Fourier transform can be applied by using the Fourier transform of the conjugate.

```<code>InverseFourier(a) = Conjugate( Fourier( Conjugate(a) ) ) / Length(a)
</code>```

I used the FFT implementation from a previous solution. That implementation uses the Cooley-Tukey algorithm for sequences where the length is a power of 2. Therefore, I have to zero-pad the input sequences to the a power of 2 (typically the minimal value that is valid) such that their lengths are greater than or equal to the sum of the lengths of the input sequences.

Usage

```<code>   f =: _2&(0((+,-)]%_1^i.@#%#)&f/@|:]\)~1<#
   g =: <:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#
   1 2 3 4 g 5 6 7 8
5 16 34 60 61 52 32
   2 4 5 6 1 g 1 2 4 7
2 8 21 46 61 61 46 7
</code>```

Try it online!

Explanation

An explanation for the FFT portion in J is included in my previous solution to a different challenge.

```<code><:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#  Input: A on LHS, B on RHS
                                      #  Get the lengths of A and B
                                    +&   Sum them
                                 #:@     Get list of binary digits
                               #@        Length
                             2^           Raise 2 to that power, call it N
                     ;                    Link A and B as a pair of boxed arrays
                          &>~             For each box
                        {.                  Take N values, extending with zeros
                      f@                    Apply FFT to it
               [:  */                    Reduce using multiplication
                 +@                      Conjugate
           f                             Apply FFT
            %                            Divide by
             #                           Length
       9 o.                              Take the real part
     #                                   Get the lengths of A and B
   +&                                    Sum them
<:@                                      Decrement
      $                                  Shape to that length and return
</code>```

Title: Convolve integers in subquadratic time

Body:
J, 79 bytes, O(n log n)

f=:_2&(0((+,-)]%_1^i.@#%#)&f/@|:]\)~1<#
<:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#

Uses the Convolution theorem which states that the Fourier transform of the convolution of two sequences is equal to the Fourier transform of each sequence multiplied together elementwise.

Fourier( Convolve(a, b) ) = Fourier(a) * Fourier(b)
Convolve(a, b) = InverseFourier( Fourier(a) * Fourier(b) )

Also uses the fact the the inverse Fourier transform can be applied by using the Fourier transform of the conjugate.

InverseFourier(a) = Conjugate( Fourier( Conjugate(a) ) ) / Length(a)

I used the FFT implementation from a previous solution. That implementation uses the Cooley-Tukey algorithm for sequences where the length is a power of 2. Therefore, I have to zero-pad the input sequences to the a power of 2 (typically the minimal value that is valid) such that their lengths are greater than or equal to the sum of the lengths of the input sequences.

Usage

   f =: _2&(0((+,-)]%_1^i.@#%#)&f/@|:]\)~1<#
   g =: <:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#
   1 2 3 4 g 5 6 7 8
5 16 34 60 61 52 32
   2 4 5 6 1 g 1 2 4 7
2 8 21 46 61 61 46 7

Try it online!

Explanation

An explanation for the FFT portion in J is included in my previous solution to a different challenge.

<:@+&#$9(o.f%#)[:+@*/;f@{.&>~2^#@#:@+&#  Input: A on LHS, B on RHS
                                      #  Get the lengths of A and B
                                    +&   Sum them
                                 #:@     Get list of binary digits
                               #@        Length
                             2^           Raise 2 to that power, call it N
                     ;                    Link A and B as a pair of boxed arrays
                          &>~             For each box
                        {.                  Take N values, extending with zeros
                      f@                    Apply FFT to it
               [:  */                    Reduce using multiplication
                 +@                      Conjugate
           f                             Apply FFT
            %                            Divide by
             #                           Length
       9 o.                              Take the real part
     #                                   Get the lengths of A and B
   +&                                    Sum them
<:@                                      Decrement
      $                                  Shape to that length and return


问:
Tips for golfing in C
What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an answer). Please post one tip per answer. Also, please include if your tip applies to C89 and/or C99 and if it only works on certain compilers.</p>

答: Knowing basic logical equalities might be able to save a couple bytes. For instance, instead of if (!(a&&b)){} try instead using DeMorgan's law if (!a||!b){}. The same applies to bitwise functions: instead of ~(a|b) do ~a&~b.

Title: Tips for golfing in C


答:
Perl 6, <s>72</s> 71 bytes

There might be a shorter way to do this

say sum await map {start {sleep 7;now -ENTER now}},^9;say now -INIT now
```

<p>this outputs</p>

<pre class="lang-perl6 prettyprint-override"><code>63.00660729694
7.0064013
</code>```

Title: Wait a minute – in less than ten seconds

Body:
Task

Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half).

The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total executed sleep time. Both time values have to have a precision of at least 0.1 seconds.

This is similar to the concept of man-hours: a job that takes 60 hours can be completed in only 6 hours if 10 workers are splitting the job. Here we can have 60 seconds of sleep time e.g. in 10 parallel threads, thus requiring only 6 seconds for the whole job to be completed.

Example

The program MyProgram creates 14 threads, each thread sleeps for 5 seconds:

MyProgram → [5.016,70.105]

The execution time is greater than 5 seconds, and the total sleep time is greater than 70 seconds because of overhead.

Body:
Perl 6, <s>72</s> 71 bytes

There might be a shorter way to do this

say sum await map {start {sleep 7;now -ENTER now}},^9;say now -INIT now

this outputs

63.00660729694
7.0064013


答:
APLX, 31 bytes

```<code>(c/t)←⌽t/⍨c←(t←⍞)∊⎕a~'aeoiuy'
t
</code>```

⎕a~'aeoiuy' lowercase alphabet without vowels

t←⍞ store character input as t

c←(…)∊ store Boolean "consonant?" as c

t/⍨ extract (consonants) from t

⌽ reverse

(c/t)← replace consonants with (the reversed ones)

t return the modified string

Title: Reverse the consonants

Body:
The program should take a string as input and reverse the consonants in it, while keeping the order of vowels. All the letters will be lowercase, so you don't have to worry about casing. Examples follow.

Input: a test case.

The consonants here are t,s,t,c,s. They should come in reversed order, i.e. s,c,t,s,t and inserted back into the string to the same positions where the pre-reversed characters were located: a sect sate.

Input: well-done. Output: nedl-lowe.

Input: reverse the consonants. Output: setenne sne cohtosarvr.

This is the code golf, the shortest solution wins.

Y should be considered vowel regardless of what it is and not reversed.

Anything, as well as numbers, punctuation, quotes, and other symbols (@#$%^&*(){}[]\|/<>~-_+=`), could potentially appear in the input.

Body:
APLX, 31 bytes

(c/t)←⌽t/⍨c←(t←⍞)∊⎕a~'aeoiuy'
t

⎕a~'aeoiuy' lowercase alphabet without vowels

t←⍞ store character input as t

c←(…)∊ store Boolean "consonant?" as c

t/⍨ extract (consonants) from t

⌽ reverse

(c/t)← replace consonants with (the reversed ones)

t return the modified string


问:
Fibonacci Factorization

Fibonacci Numbers

Fibonacci Numbers start with f(1) = 1 and f(2) = 1 (some includes f(0) = 0 but this is irrelevant to this challenge. Then, for n > 2, f(n) = f(n-1) + f(n-2).

The challenge

Your task is to find and output the n-th positive number that can be expressed as products of Fibonacci numbers. You can choose to make it 0-indexed or 1-indexed, whichever suits you better, but you must specify this in your answer.

Also, your answer must compute the 100th term in a reasonable time.

Testcases

```<code>n   result corresponding product (for reference)
1   1      1
2   2      2
3   3      3
4   4      2*2
5   5      5
6   6      2*3
7   8      2*2*2 or 8
8   9      3*3
9   10     2*5
10  12     2*2*3
11  13     13
12  15     3*5
13  16     2*2*2*2 or 2*8
14  18     2*3*3
15  20     2*2*5
16  21     21
17  24     2*2*2*3 or 3*8
18  25     5*5
19  26     2*13
20  27     3*3*3
100 315    3*5*21
</code>```

References

Obligatory OEIS A065108

答:
Python 3, <s>175</s> <s>170</s> 148 bytes

Thanks to @Dennis for -22 bytes

```<code>j=x=int(input())
y=1,1
exec('y+=y[-2]+y[-1],;'*x)
i=c=0
while c<x:
    if j>=x:j=0;i+=1;t=i
    if t%y[~j]<1:t/=y[~j];j-=1
    if t<2:c+=1;j=x
    j+=1
print(i)
</code>```

Takes input from STDIN and prints to STDOUT. This is one-indexed. Computing the 100th term takes roughly a tenth of a second.

How it works

```<code>j=x=int(input())                Get term number x from STDIN and set Fibonacci number index
                                j to x to force initialisation of j later
y=1,1                           Initialise tuple y with start values for Fibonacci sequence
exec('y+=y[-2]+y[-1],;'*x)      Compute the Fibonacci sequence to x terms and store in y
i=c=0                           Initialise test number i and term counter c
while c<x:                      Loop until x th term is calculated
    if j>=x:j=0;i+=1;t=i        Initialise Fibonacci number index j, increment i and
                                initialise temp variable t for looping through all j for
                                some i. Executes during the first pass of the loop since
                                at this point, j=x
    if t%y[~j]<1:t/=y[~j];j-=1  Find t mod the j th largest Fibonacci number in y and if no
                                remainder, update t by dividing by this number.
                                Decrementing j means that after a later increment, no
                                change to j occurs, allowing for numbers that are
                                divisible by the same Fibonacci number more than once by
                                testing again with the same j
    if t<2:c+=1;j=x             If repeated division by ever-smaller Fibonacci numbers
                                leaves 1, i must be a Fibonacci product and c is
                                incremented. Setting j equal to x causes j to be reset
                                to 0 during the next loop execution
    j+=1                        Increment j
print(i)                        i must now be the x th Fibonacci product. Print i to STDOUT
</code>```

Try it on Ideone

Title: Fibonacci Factorization

Body:
Python 3, <s>175</s> <s>170</s> 148 bytes

Thanks to @Dennis for -22 bytes

j=x=int(input())
y=1,1
exec('y+=y[-2]+y[-1],;'*x)
i=c=0
while c<x:
    if j>=x:j=0;i+=1;t=i
    if t%y[~j]<1:t/=y[~j];j-=1
    if t<2:c+=1;j=x
    j+=1
print(i)

Takes input from STDIN and prints to STDOUT. This is one-indexed. Computing the 100th term takes roughly a tenth of a second.

How it works

j=x=int(input())                Get term number x from STDIN and set Fibonacci number index
                                j to x to force initialisation of j later
y=1,1                           Initialise tuple y with start values for Fibonacci sequence
exec('y+=y[-2]+y[-1],;'*x)      Compute the Fibonacci sequence to x terms and store in y
i=c=0                           Initialise test number i and term counter c
while c<x:                      Loop until x th term is calculated
    if j>=x:j=0;i+=1;t=i        Initialise Fibonacci number index j, increment i and
                                initialise temp variable t for looping through all j for
                                some i. Executes during the first pass of the loop since
                                at this point, j=x
    if t%y[~j]<1:t/=y[~j];j-=1  Find t mod the j th largest Fibonacci number in y and if no
                                remainder, update t by dividing by this number.
                                Decrementing j means that after a later increment, no
                                change to j occurs, allowing for numbers that are
                                divisible by the same Fibonacci number more than once by
                                testing again with the same j
    if t<2:c+=1;j=x             If repeated division by ever-smaller Fibonacci numbers
                                leaves 1, i must be a Fibonacci product and c is
                                incremented. Setting j equal to x causes j to be reset
                                to 0 during the next loop execution
    j+=1                        Increment j
print(i)                        i must now be the x th Fibonacci product. Print i to STDOUT

Try it on Ideone


问:
King of the Hill - Spacewar!

If you've ever played Spacewar!, you know it was a fun game. If you haven't, know this: it was (and is) one of the very first and most important computer games. And it's still fun! The clone I grew up on is this one, which is, apparently and unfortunately, Windows only. So I recreated it!

The KotH is hosted here: PPCG - Spacewar! King of the Hill. I encourage you to play as a human against at least one other bot to get a feel for how the game works.

The Game

One frame is 30 milliseconds (thus, about 33 frames per second).

The field is 800 pixels wide and 600 pixels tall.

The field is toroidal, meaning that spaceships and missiles that move outside of the field reappear on the opposite side.

There are two spaceships, red and blue.

Red is positioned at x=50 and random y between 50, (field height - 50) pixels.

Blue is positioned at x=(field width - 50) and random y between 50, (field height - 50) pixels.

Both face x = (field width)/2.

The available controls are:

Turn left - 5 degrees per frame counterclockwise.

Turn right - 5 degrees per frame clockwise.

Fire missile - travels at an extra 10 pixels per frame in addition to the velocity of the ship, in the direction the ship was pointing.

Fire engine - accelerates the spaceship at 0.30 pixels per frame in the direction the spaceship is pointing.

Hyperspace jump - teleports to some random coordinates in the field, with a 25% chance of exploding. These random coordinates may be on top of the sun.

The maximum speed for ships is 15 pixels per frame under engine power and 40 pixels per frame when gravity-boosted.

When traveling faster than 15 pixels per frame, engine thrust may only change direction or slow down.

Regarding missiles:

Missiles travel in a straight line.

Missiles may be fired at a maximum rate of 1 per 0.1 seconds.

Missiles have a lifetime of 2.25 seconds.

Ships have a maximum of 20 missiles each.

Missiles are point particles internally.

There is a sun in the very center that is extremely hazardous to your ship. The slightest contact is fatal. This sun also destroys missiles.

The sun has gravity. The resultant acceleration is 5000/(distance^2) pixels/frame^2, where distance is in pixels. Spaceships and missiles are affected.

Both ships have three strike zones: the nose, the left wing, and the right wing.

A hit on the nose is instant death.

A hit on either wing reduces the spaceship's turn rate and engine acceleration by half.

If both wings are destroyed, the spaceship cannot be maneuvered and can only fire missiles.

Ships may collide with each other.

A nose-nose impact is fatal for both ships.

A nose-wing impact destroys the wing.

A wing-wing impact destroys both wings.

Dead ships are solid and frozen until they explode 1 second later.

After at least one ship has died, the field is reset 3 seconds later. Until then, the sun and any remaining missiles are still hazardous.

The original game also has deadly and indestructible asteroids, but I won't include those.

The Rules

Your bot must be written in JavaScript.

Your bot should limit its decision to about 10 milliseconds. If I notice consistent lag because of your bot, I'll disqualify it and let you know so you can fix it.

Bots will have access to the following:

Field width and field height

Sun position and radius

The position, rotation, velocity, shape, missile stock, and in-hyperspace status of both ships

The position and velocity of all missiles

When prompted, your bot should return a list of strings.

These strings should be one of the following: turn left, turn right, fire engine, fire missile, hyperspace. Any other string will be ignored.

If there are any duplicates, only the first will be noted.

hyperspace takes precedence over all others.

turn left and turn right at the same time will have no effect.

fire engine will have no effect if the ship only has the nose or is dead.

fire missile will have no effect if a missile was fired too recently.

In a change from the usual, your bot is allowed to exploit the behavior of other bots. I want to encourage a metagame.

Bots may not emulate other bots. (I.e., no mind-reading.)

Bots may not set any variables used by the game and physics code. (I.e., no cheating.)

Bot Implementation Details

I will be storing your bot in its own JavaScript file that is automatically included, with the filename bot_<name>.js. So don't put any spaces or characters that would interfere with this or with naming a function in JavaScript. That's because you should define the following functions: <name>_setup(team) and <name>_getActions(gameInfo, botVars). Further down the page, there exist textareas for the userbot, which you can edit to test your code.

<name>_setup(team)

This function is for you to define any variables that you want to persist. team will be either "red" or "blue". This function must return an object. Define variables like so:

var vars = {};
vars['example'] = "example";
return vars;
```

<p>This <code>vars</code> object will be passed in to the other function:</p>

<h3><code><name>_getActions(gameInfo, botVars)</code></h3>

<p><code>botVars</code> is the object returned by <code><name>_setup(team)</code>. <code>gameInfo</code> is an object containing the following variables:</p>

<pre class="lang-js prettyprint-override"><code>redScore
blueScore
timeLeft

fieldWidth
fieldHeight

sun_x
sun_y
sun_r //sun's radius

gravityStrength //acceleration in pixels/frame^2 at 1 pixel away from the sun's center
engineThrust    //acceleration in pixels/frame^2

speedLimit //maximum speed under engine power
maxSpeed   //maximum speed from gravity boosts

red_x
red_y
red_rot          //rotation in degrees
red_xv           //x velocity
red_yv           //y velocity
red_shape        //one of "full ship", "left wing", "right wing", "nose only"
red_missileStock //the number of missiles red has left
red_inHyperspace //true if red is in hyperspace
red_exploded     //until red explodes, it is still solid and hazardous
red_alive
// likewise for blue //

numMissiles
missiles //this is a list of objects, each with the following variables
  x
  y
  xv
  yv
</code>```

Your bot has full access to these. I'm pretty sure that you can write to them and not affect the original variables, but don't do it anyway. A note on rotations: ships point in the +y direction, downwards, so anything that you want to align with the ship needs to be offset by 90 degrees. Also, positive rotation is clockwise.

This function must return a list of strings, representing your bot's actions. For example, ["turn right","thrust"]. More details on this are in the Rules section.

Additional Details

You may also make use of the following:

LineIntersection(L1, L2)

L1 and L2 are two-element arrays of two-element arrays. That is, L1 := [[x1,y1],[x2,y2]] and L2 := [[u1,v1],[u2,v2]]. This function computes the intersection of two lines and returns this: [[x,y], [a,b]]. [x,y] are the coordinates of the intersection point and [a,b] is a pair of ratios that express how far along each line the intersection point is. As in, a = 0.25 would mean that the intersection point is a quarter of the way from [x1,y1] to [x2,y2], and likewise for b. If there is no intersection, an empty array is returned.

window["shipShapes"]

var shipShapes = {
    'full ship': [[-8,16],[0,-8],[8,16]],
    'left wing': [[-8,16],[0,-8],[4,4],[0,8],[0,16]],
    'right wing':[[-4,4],[0,-8],[8,16],[0,16],[0,8]],
    'nose only': [[-4,4],[0,-8],[4,4],[0,8]]
};
```

<p>These are the coordinates of the ships' polygons. To make getting the current coordinates easier, you may also use...</p>

<h3><code>getShipCoords(<color>)</code></h3>

<p><code>getShipCoords("red")</code> will return the current coordinates of the vertices of Red's ship, and likewise for <code>getShipCoords("blue")</code> and Blue. These coordinates are in a list like so: <code>[[x1,y1],[x2,y2],[x3,y3],...]</code>. Polygons are implicitly closed, so there is a line between the first and last coordinate pairs.</p>

<p><strong>You may not access or alter any other variables or functions in use by the game/website.</strong> And definitely don't name your functions the same. I don't foresee that this will be a problem, but if your bot breaks the game code, that's one possibility. There is no logging or catching of exceptions.</p>

<h2>Winning</h2>

<ul>
<li>Every pairing of bots shall be played at least 10 times, both ways. (So, at least 20 games total.)</li>
<li>Aim to have the highest win/loss ratios <em>overall</em>. If your bot does super well against one other bot, but loses against the other three, that's not as good as winning against two and losing against two (as a general rule of thumb).</li>
<li>For every bot, the ratios (wins+1)/(losses+1) will be calculated, then the mean and standard deviation of these ratios will be calculated. A higher mean will have priority, and in case means are within 1 unit of each other, the lower variance will have priority.</li>
<li>Scoring will begin either in a week from today or after three days of no new submissions. This is so I don't have to repeat any pairing of bots.</li>
</ul>

<p><strong>Above all, have fun!</strong></p>

<hr>

<h2>Leaderboard (2016-01-08 05:15):</h2>

<pre class="lang-js prettyprint-override"><code>#   Name                       Mean      StdDev
1.  Helios                     13.625    6.852
2.  EdgeCase                    8.335    8.155
3.  OpponentDodger              8.415    8.186
4.  OrbitBot                    5.110    6.294
5.  SunAvoider                  5.276    6.772
6.  DangitBobby                 3.320    4.423
7.  SprayAndPray                3.118    4.642
8.  Engineer                    3.903    6.315
9.  RighthandedSpasms           1.805    2.477
10. AttackAndComeBack           2.521    2.921
11. PanicAttack                 2.622    3.102
12. FullSpeedAhead              2.058    3.295
13. UhhIDKWhatToCallThisBot     2.555    3.406
14. MissilesPlusScore           0.159    0.228
15. Hyper                       0.236    0.332
16. RandUmmm                    0.988    1.329
17. Kamikaze                    0.781    1.793
</code>```

Note: This is subject to change as I run more games. Plus, the ordering of ranks 9-13 bothers me, so I may tweak the scoring method to better match one's intuition of how they should be ranked.

(Means and standard deviations were rounded to three decimal digits. Also, Hyper should be HYPER but that messes up the highlighting. :P)

答:
SmartArrow

Like Arrow, but smart

```<code>function SmartArrow_setup(team) {
    var botVars = {};
    botVars['mpref'] = team + '_';
    botVars['epref'] = team == 'red' ? 'blue_' : 'red_';
    botVars['ecolor'] = team == 'red' ? 'blue' : 'red';
    return botVars;
}

function SmartArrow_getActions(gameInfo, botVars) {
    var actions = [];
    var x = gameInfo[botVars['mpref'] + 'x'],
        y = gameInfo[botVars['mpref'] + 'y'],
        rot = gameInfo[botVars['mpref'] + 'rot']; // SmartArrow position and rotation
    var ex = gameInfo[botVars['epref'] + 'x'],
        ey = gameInfo[botVars['epref'] + 'y']; // Enemy position
    var sunx = gameInfo.sun_x,
        suny = gameInfo.sun_y; // Sun position
    var Dsunx = Math.abs(x - sunx),
        Dsuny = Math.abs(y - suny); // Sun position delta
    var dex = Math.abs(x - ex),
        dey = Math.abs(y - ey); // Enemy position delta
    var sangle = Math.degrees(Math.atan2(suny - y, sunx - x)),
        snrot = (rot - sangle + 360) % 360;
    if (Dsunx < 40 && Dsuny < 40) // If SmartArrow is too close from sun, hyperspace !
        return ['hyperspace'];
    var missiles = gameInfo.missiles;
    for (var i = 0; i < missiles.length; i++) { // Avoid all these silly missiles
        var dx = Math.abs(x - missiles[i].x),
            dy = Math.abs(y - missiles[i].y);
        if (dx < 10 && dy < 10)
            return ['hyperspace'];
    }
    if (gameInfo[botVars['epref'] + 'alive']) { // If his enemy is alive, SmartArrow try to kill him (logic)
        var angle = Math.degrees(Math.atan2(ey - y, ex - x)),
            nrot = (rot - angle + 360) % 360;
        if (nrot > 90 && nrot < 270)
            actions.push('turn left');
        else
            actions.push('turn right');
        if (nrot > 80 && nrot < 100
         && Math.random() > 0.5) actions.push('fire missile'); // If SmartArrow is in a good spot, shot this silly oponnent
        if (Math.random() > 0.5) actions.push('fire engine');
    }
    else { // Simply (try to) act like SunAvoider if his enemy is dead
        if (snrot > 90 && snrot < 270)
            actions.push('turn right');
        else
            actions.push('turn left');
        if (Dsunx < 300 && Dsuny < 300)
            actions.push('fire engine');
        if (dex < 40 && dey < 40)
            actions.push('hyperspace'); // Dying on the corpse of his opponent is dumb.
    }
    return actions;
}
</code>```

Title: King of the Hill - Spacewar!

Body:
SmartArrow

Like Arrow, but smart

function SmartArrow_setup(team) {
    var botVars = {};
    botVars['mpref'] = team + '_';
    botVars['epref'] = team == 'red' ? 'blue_' : 'red_';
    botVars['ecolor'] = team == 'red' ? 'blue' : 'red';
    return botVars;
}

function SmartArrow_getActions(gameInfo, botVars) {
    var actions = [];
    var x = gameInfo[botVars['mpref'] + 'x'],
        y = gameInfo[botVars['mpref'] + 'y'],
        rot = gameInfo[botVars['mpref'] + 'rot']; // SmartArrow position and rotation
    var ex = gameInfo[botVars['epref'] + 'x'],
        ey = gameInfo[botVars['epref'] + 'y']; // Enemy position
    var sunx = gameInfo.sun_x,
        suny = gameInfo.sun_y; // Sun position
    var Dsunx = Math.abs(x - sunx),
        Dsuny = Math.abs(y - suny); // Sun position delta
    var dex = Math.abs(x - ex),
        dey = Math.abs(y - ey); // Enemy position delta
    var sangle = Math.degrees(Math.atan2(suny - y, sunx - x)),
        snrot = (rot - sangle + 360) % 360;
    if (Dsunx < 40 && Dsuny < 40) // If SmartArrow is too close from sun, hyperspace !
        return ['hyperspace'];
    var missiles = gameInfo.missiles;
    for (var i = 0; i < missiles.length; i++) { // Avoid all these silly missiles
        var dx = Math.abs(x - missiles[i].x),
            dy = Math.abs(y - missiles[i].y);
        if (dx < 10 && dy < 10)
            return ['hyperspace'];
    }
    if (gameInfo[botVars['epref'] + 'alive']) { // If his enemy is alive, SmartArrow try to kill him (logic)
        var angle = Math.degrees(Math.atan2(ey - y, ex - x)),
            nrot = (rot - angle + 360) % 360;
        if (nrot > 90 && nrot < 270)
            actions.push('turn left');
        else
            actions.push('turn right');
        if (nrot > 80 && nrot < 100
         && Math.random() > 0.5) actions.push('fire missile'); // If SmartArrow is in a good spot, shot this silly oponnent
        if (Math.random() > 0.5) actions.push('fire engine');
    }
    else { // Simply (try to) act like SunAvoider if his enemy is dead
        if (snrot > 90 && snrot < 270)
            actions.push('turn right');
        else
            actions.push('turn left');
        if (Dsunx < 300 && Dsuny < 300)
            actions.push('fire engine');
        if (dex < 40 && dey < 40)
            actions.push('hyperspace'); // Dying on the corpse of his opponent is dumb.
    }
    return actions;
}


问:
Golf all the 16 logic gates with 2 inputs and 1 output!
For example, the gate A and B is a logic gate with 2 inputs and 1 output.

There are exactly 16 of them, because:

each logic gate takes two inputs, which can be truthy or falsey, giving us 4 possible inputs

of the 4 possible inputs, each can have an output of truthy and falsey

therefore, there are 2^4 possible logic gates, which is 16.

Your task is to write 16 programs/functions which implement all of them separately.

Your functions/programs must be independent.

They are valid as long as they output truthy/falsey values, meaning that you can implement A or B in Python as lambda a,b:a+b, even if 2 is produced for A=True and B=True.

Score is total bytes used for each function/program.

List of logic gates

0,0,0,0 (false)

0,0,0,1 (and)

0,0,1,0 (A and not B)

0,0,1,1 (A)

0,1,0,0 (not A and B)

0,1,0,1 (B)

0,1,1,0 (xor)

0,1,1,1 (or)

1,0,0,0 (nor)

1,0,0,1 (xnor)

1,0,1,0 (not B)

1,0,1,1 (B implies A)

1,1,0,0 (not A)

1,1,0,1 (A implies B)

1,1,1,0 (nand)

1,1,1,1 (true)

Where the first number is the output for A=false, B=false,
the second number is the output for A=false, B=true,
the third number is the output for A=true, B=false,
the fourth number is the output for A=true, B=true.

Leaderboard

var QUESTION_ID=82938,OVERRIDE_USER=48934;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+(?:\.\d+)?)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Yup, 109 + 80 = 189 bytes

+80 bytes for 16 -x 0 flags. For removing the imaginary parts.

0000 false           0#
0001 and             *|0*|--e#
0010 A and not B     **-#
0011 A               *#
0100 not A and B     0**--#
0101 B               **#
0110 xor             **-:|~|0~--e#
0111 or              *0*--#
1000 nor             0e*0*---#
1001 xnor            0e**-:|~|0~--e-#
1010 not B           *0e*-#
1011 B implies A     **|-#
1100 not A           0e*-#
1101 A implies B     0e**--
1110                 0e00e--*0*---#
1111 true            0e#

Try it online!


答:
R, 120 bytes

New answer:

```<code>az=function(x){
y=strsplit(x, NULL)[[1]]
a=regexpr("[bc-df-hj-np-tv-z]", y)
y[a==1]=rev(y[a==1])
paste(y, collapse="")
}
</code>```

takes a character string as x

```<code>az("reverse the consonants")
[1] "setenne sne cohtosarvr"
</code>```

Old response below (110 bytes) was poor form on my part, which just reversed the consonants:

```<code>xrev=function(x){y=rev(strsplit(x, NULL)[[1]])
paste(y[is.na(match(y, c("a", "e","i","o","u","y")))], collapse="")}
</code>```

Title: Reverse the consonants

Body:
R, 120 bytes

New answer:

az=function(x){
y=strsplit(x, NULL)[[1]]
a=regexpr("[bc-df-hj-np-tv-z]", y)
y[a==1]=rev(y[a==1])
paste(y, collapse="")
}

takes a character string as x

az("reverse the consonants")
[1] "setenne sne cohtosarvr"

Old response below (110 bytes) was poor form on my part, which just reversed the consonants:

xrev=function(x){y=rev(strsplit(x, NULL)[[1]])
paste(y[is.na(match(y, c("a", "e","i","o","u","y")))], collapse="")}


答:
Python 2, <s>120</s> 107 bytes

g=lambda k:1/k+any(k%i==0<g(k/i)for i in F)
F=2,3;k=0;n=input()
while n:F+=F[k]+F[-1],;k+=1;n-=g(k)
print k
```

Test it on Ideone.

How it works

We initialize F as the tuple (2, 3) (the first two Fibonacci number greater than 1), k as 0 and n as an integer read from STDIN.

While n is positive, we do the following:

Append the next Fibonacci number, computed as F[k] + F[-1], i.e., the sum of the last two elements of F to the tuple F.

Increment k.

Subtract g(k) from n.

g returns 1 if and only if k is a product of Fibonacci numbers, so once n reaches 0, k is the nth Fibonacci number and we print it to STDOUT.

g achieves its purpose as follows.

If k is 1, it is a product of Fibonacci numbers, and 1/k makes sure we return 1.

If k is greater than 1, we call g(k/i) recursively for all Fibonacci numbers i in F.

g(k/i) recursively tests if k / i is a Fibonacci number product. If g(k/i) returns 1 and i divides k evenly, k % i = 0 and the condition k%i<g(k/i) holds, so g will return 1 if and only if there is a Fibonacci number such that k is the product of that Fibonacci number and another product of Fibonacci numbers.

Title: Fibonacci Factorization

Body:
Fibonacci Numbers

Fibonacci Numbers start with f(1) = 1 and f(2) = 1 (some includes f(0) = 0 but this is irrelevant to this challenge. Then, for n > 2, f(n) = f(n-1) + f(n-2).

The challenge

Your task is to find and output the n-th positive number that can be expressed as products of Fibonacci numbers. You can choose to make it 0-indexed or 1-indexed, whichever suits you better, but you must specify this in your answer.

Also, your answer must compute the 100th term in a reasonable time.

Testcases

```<code>n   result corresponding product (for reference)
1   1      1
2   2      2
3   3      3
4   4      2*2
5   5      5
6   6      2*3
7   8      2*2*2 or 8
8   9      3*3
9   10     2*5
10  12     2*2*3
11  13     13
12  15     3*5
13  16     2*2*2*2 or 2*8
14  18     2*3*3
15  20     2*2*5
16  21     21
17  24     2*2*2*3 or 3*8
18  25     5*5
19  26     2*13
20  27     3*3*3
100 315    3*5*21
</code>```

References

Obligatory OEIS A065108

Body:
Python 2, <s>120</s> 107 bytes

g=lambda k:1/k+any(k%i==0<g(k/i)for i in F)
F=2,3;k=0;n=input()
while n:F+=F[k]+F[-1],;k+=1;n-=g(k)
print k

Test it on Ideone.

How it works

We initialize F as the tuple (2, 3) (the first two Fibonacci number greater than 1), k as 0 and n as an integer read from STDIN.

While n is positive, we do the following:

Append the next Fibonacci number, computed as F[k] + F[-1], i.e., the sum of the last two elements of F to the tuple F.

Increment k.

Subtract g(k) from n.

g returns 1 if and only if k is a product of Fibonacci numbers, so once n reaches 0, k is the nth Fibonacci number and we print it to STDOUT.

g achieves its purpose as follows.

If k is 1, it is a product of Fibonacci numbers, and 1/k makes sure we return 1.

If k is greater than 1, we call g(k/i) recursively for all Fibonacci numbers i in F.

g(k/i) recursively tests if k / i is a Fibonacci number product. If g(k/i) returns 1 and i divides k evenly, k % i = 0 and the condition k%i<g(k/i) holds, so g will return 1 if and only if there is a Fibonacci number such that k is the product of that Fibonacci number and another product of Fibonacci numbers.


问:
Parity of Nth Term in Fibonacci Integer Sequences
If you look at the Fibonacci Numbers, you will notice a pattern in their parity: 0, 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144. Every third number is even, and all the others are odd. This makes sense because an even plus an odd is odd, but an odd plus an odd is even and the sum for a term will always include at least one even number unless the last two terms were odd, which happens every three terms.

In this challenge you will have to look at a generalization of this problem.

Specs

You will be given as input two positive integers describing the Fibonacci integer sequence you will have to look at.

For example, 0, 1 describes the original Fibonacci numbers, and 2, 1 would be the Lucas numbers. The sequence is calculated with the recurrence relation: x(n+2)=x(n+1)+x(n).

You will also take a positive integer n.

Your code has to output the parity of the nth term of the described Fibonacci integer sequence (0 indexed).

The output format can be any two sane, consistent outputs (e.g. 0 for even and 1 for odd).

Test Cases

```<code>(Fibonacci numbers) [0, 1], 4  ->  odd
(Lucas numbers) [2, 1], 9  ->  even
[14, 17], 24  ->  even
[3, 9], 15  ->  odd
[2, 4], 10  ->  even
</code>```

答:
Julia, 23 bytes

x\n=[x;sum(x)][n%3+1]%2
```

Try it online!

Body:
Julia, 23 bytes

x\n=[x;sum(x)][n%3+1]%2

Try it online!


问:
The alphabet in programming languages
Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose name starts with that letter.

Input: none

Output:

```<code>abcdefghijklmnopqrstuvwxyz
</code>```

uppercase and trailing newline optional

Rules:

The scoring metric is the length of the programming language name, plus the length of the code.  Hence, C will be assessed a "penalty" of 1, while GolfScript will be assessed a penalty of 10.

One language/implementation per answer.  Multiple answers are encouraged.

If a programming language name's first letter is not an English letter, it should not be coerced into one.  It will be treated as a separate letter (meaning less competition).

No answer will be accepted until every English letter has a solution.

Current rankings:

APL: 5

Brachylog: 11

Canvas: 7

DOS: 13

Eso2D: 20

Fish: 20

Gaia: 6

Husk: 8

IPEL: 23

Japt: 6

Keg: 6

Ly: 13

MathGolf: 9

Ni: 15

Owl: 14

Pip: 4

QuadR: 31

Ruby: 17

Stax: 6

Thunno: 8

Unix Shell: 31

V: 4

W: 4

XJam: 10

Yorick: 36

Z80Golf: 16

Tell me if I'm missing anybody.

Automatic leaderboard (experimental)

var QUESTION_ID=2078;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&r.indexOf('non-competing')===-1&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],lang:/a)-(d<a)||e.size-s.size});var s={},a=null,n="A";e.forEach(function(e){n=e.lang[0].toUpperCase(),a=e.size;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+" is for").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.lang,p=o[0].toUpperCase();s[p]=s[p]||{language:e.language,lang:e.lang,letter:p,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return(e.letter>s.letter)-(e.letter<s.letter)});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.language).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),jQuery("#languages").append(jQuery(i))}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*(?:<[^>]+>)?(?:[^]+?for )?((?:]*?>)?(?:(?! [(=→-])[^\n,:])*[^\s,:])(?:[,:]| [(=→-]).*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px} /* font fix */ body {font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;} /* #language-list x-pos fix */ #answer-list {margin-right: 200px;}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Winners by Letter

Language	User	Score

{{PLACE}}	{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Everything

	Language	Author	Size

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
A is for APL, 2 → 5

```<code>⎕a
</code>```

Works on MicroAPL's APLX.

ContentLicense: CC BY-SA 4.0

Title: The alphabet in programming languages

Body:
A is for APL, 2 → 5

⎕a

Works on MicroAPL's APLX.


答:
Actually, 12 bytes

```<code>╗│+k3╜%@E2@%
</code>```

This uses the same strategy as xnor's Python answer. Input is a b n, with the spaces replaced by newlines. Output is 0 for even parity and 1 for odd parity.

Try it online!

Explanation:

```<code>╗│+k3╜%@E2@%
              implicit input ([a, b, n])
╗             save n in reg0 ([a, b])
 │            duplicate stack ([a, b, a, b])
  +k          add, push stack as list ([[a, b, a+b]])
    3╜%       n mod 3 ([[a, b, a+b], n%3])
       @E     element in list ([[a, b, a+b][n%3])
         2@%  mod 2 ([[a, b, a+b][n%3]%2)
</code>```

Title: Parity of Nth Term in Fibonacci Integer Sequences

Body:
If you look at the Fibonacci Numbers, you will notice a pattern in their parity: 0, 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144. Every third number is even, and all the others are odd. This makes sense because an even plus an odd is odd, but an odd plus an odd is even and the sum for a term will always include at least one even number unless the last two terms were odd, which happens every three terms.

In this challenge you will have to look at a generalization of this problem.

Specs

You will be given as input two positive integers describing the Fibonacci integer sequence you will have to look at.

For example, 0, 1 describes the original Fibonacci numbers, and 2, 1 would be the Lucas numbers. The sequence is calculated with the recurrence relation: x(n+2)=x(n+1)+x(n).

You will also take a positive integer n.

Your code has to output the parity of the nth term of the described Fibonacci integer sequence (0 indexed).

The output format can be any two sane, consistent outputs (e.g. 0 for even and 1 for odd).

Test Cases

```<code>(Fibonacci numbers) [0, 1], 4  ->  odd
(Lucas numbers) [2, 1], 9  ->  even
[14, 17], 24  ->  even
[3, 9], 15  ->  odd
[2, 4], 10  ->  even
</code>```

Body:
Actually, 12 bytes

╗│+k3╜%@E2@%

This uses the same strategy as xnor's Python answer. Input is a b n, with the spaces replaced by newlines. Output is 0 for even parity and 1 for odd parity.

Try it online!

Explanation:

╗│+k3╜%@E2@%
              implicit input ([a, b, n])
╗             save n in reg0 ([a, b])
 │            duplicate stack ([a, b, a, b])
  +k          add, push stack as list ([[a, b, a+b]])
    3╜%       n mod 3 ([[a, b, a+b], n%3])
       @E     element in list ([[a, b, a+b][n%3])
         2@%  mod 2 ([[a, b, a+b][n%3]%2)