New answers tagged

0 votes

Print every Fool's Mate

Octave, 77 bytes printf('1.%c%c e%c 2.%c%c Qh4#\n','f35g4f36g4f45g4f46g4g45f3g45f4g46f3g46f4') Try it online!
0 votes

Print every Fool's Mate

Jelly, 37 bytes “ḲṚẉċ‘ḤD“feg”żⱮ;Ṛ€$“1.““2.“Qh4#”żⱮK€Y A full program that prints the eight games. Try it online! ...
2 votes

Print every Fool's Mate

Whitespace, 380 378 bytes ...
2 votes

Print every Fool's Mate

05AB1E, 37 36 bytes 56āÌ'fìâ„g4δšDí«ε`"1.ÿ eÿ 2.ÿ Qh4#", Try it online. If outputting as a list of lines is allowed, the trailing ...
0 votes

Print every Fool's Mate

Python 3, 118 bytes for f in 0,1: x='f3','f4';y='g4', if f:y,x=x,y [print(f'1.{w} e{r} 2.{W} Qh4#')for w in x for W in y for r in[5,6]] Try it online!
  • 707
3 votes

Print every Fool's Mate

Python 3, 76 bytes print('1.%s%s e%%s 2.%s%s Qh4#\n'*4%(*'g4f3g4f4f4g4f3g4',)*2%(*'55556666',)) Try it online! Can definitely be improved. Python 3, 73 bytes <...
  • 18.6k
1 vote

Print every Fool's Mate

Charcoal, 37 bytes FE34⁺g4fιF⪪ι²E56⪫⟦1.⁻ικ eλ 2.κ Qh4#⟧ω Try it online! Link is to verbose version of code. Explanation: ...
  • 147k
5 votes

Print every Fool's Mate

Vyxal j, 36 bytes \f43f+56fẊ‛g4vJ:RJƛ÷`1.Π eΠ 2.Π Qh4# Try it Online! This was... annoying ...
  • 31.9k
2 votes

Print every Fool's Mate

Regenerate -a, 42 bytes 1.(f[34] e[56] 2.g4|g4 e[56] 2.f[34]) Qh4# Attempt This Online! Explanation The logic is a bit clunkier ...
  • 34.3k
12 votes

Print every Fool's Mate

Bash, 61 This is a pretty good challenge for bash brace expansions printf '1.%s Qh4# ' f{3,4}\ e{5,6}\ 2.g4 g4\ e{5,6}\ 2.f{3,4} Try it online!
1 vote

Print every Fool's Mate

C (gcc), 156 131 130 111 105 103 bytes Some bytes lost because of @Steffan. ...
2 votes

Print every Fool's Mate

Retina 0.8.2, 62 60 bytes g4#f3¶f3#g4 # e5 2. .+ 1.$& Qh4# 3 $&$%'¶$%`4 5 $&$%'¶$%`6 Try it online! Edit: Saved 2 bytes thanks to @DLosc. Explanation:...
  • 147k
4 votes

Print every Fool's Mate

C (gcc), 104 99 90 bytes f(i){for(i=8;i--;printf("1.%c%d e%d 2.%c%d Qh4#\n",102+i/4,3+(i>1),6-i%2,103-i/4,4-i/6));} Try it online! -3 bytes thanks to ...
  • 2,287
5 votes

Print every Fool's Mate

JavaScript (V8), 80 bytes -2 bytes by using a full program, as suggested by @dingledooper -2 bytes thanks to @Kevin Cruijssen ...
  • 170k
0 votes

Generate the Chess Numbers™

Pyth, 12 11 bytes iR18*}T17S8 Try it here! -1 byte thanks to Steffan! Explanation: ...
  • 4,051
2 votes

Generate the Chess Numbers™

Python 3, 53 bytes b=181 while b<308:[print(b+x)for x in range(8)];b+=18 Try it online! I believe this straightforward solution is currently the shortest ...
  • 707
1 vote

A challenge for rookies

C (gcc), 140 bytes ...
  • 583
4 votes

A challenge for rookies

gbz80 machine code, 73 72 70 bytes ...
  • 141
4 votes

The smallest number of steps for a chess piece to reach a position

Charcoal, 110 bytes UO⁸ψUB.Nθ⊞υ⟦⁰NN⟧Fυ«≔⊟ιζ≔⊟ιηJζη¿¬℅KKF⁸F⁸«PIΣι≔⁺X⁻λζ²X⁻κη²ε≔⟦⁼↔⁻κη↔⁻λζ∨⁼κη⁼λζ⟧δ¿§⟦›³ε⌈δ⊟δ⊟δ⁼⁵ε∧⁼κ⊖η⁼λζ⟧θ⊞υ⟦⊕Σικλ Try it online! Link is to ...
  • 147k
11 votes

The smallest number of steps for a chess piece to reach a position

JavaScript (ES7), 175 bytes Expects (P, X, Y) where \$X\$ and \$Y\$ are 0-indexed and \$P \in\{3,4,5,6,7,10\}\$, as described in the Piece encoding paragraph below. ...
  • 170k
7 votes
Accepted

The smallest number of steps for a chess piece to reach a position

APL (Dyalog APL), 133 127 108 100 91 81 80 bytes {(⊂∘.(⍺⌷9*(××(×,,,1⍺≠+)⍥|-×+),1 0≢,)⍨8-⍳15){⍵⌊s↑⌊⌿↑,(8-⍳s)↓¨⍺+⍵}⍣≡9×⍵≢¨⍳s←8 8}∘⊂ Attempt This Online! Update: -19 ...
  • 4,480
8 votes

smallest number of steps for a knight in chess

gbz80 machine code on Better Game Boy, 128 127 124 123 118 117 bytes ...
  • 141

Top 50 recent answers are included