Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 36398

Chess is a strategic game played with two players on a checkered grid. This tag is for challenges related to chess or any variation on chess.

9 votes

smallest number of steps for a knight in chess

MATL, 34 32 31 29 bytes 8t&Oli(9:"tt3Zv&+3=Z+g<@Q*+]q Input is a cell array with the vertical and horizontal coordinates, starting at top left, 1-based. Try it online! How it works 8t&O % Push 8 …
Luis Mendo's user avatar
  • 105k
10 votes

Seeing the queen's lasers

MATL, 52 49 48 45 bytes 9,i:i-]!=E2M+~+4KGY(3HGZ(3M*+^4Y6Z+9_YA!gsIGe Input order is: board width, queen x, board height, queen y. Try it online! Or verify all test cases. The code first generates th …
Luis Mendo's user avatar
  • 105k
3 votes

Knight Distance

MATL, 29 bytes `JEQ2J-htZjht_h@Z^2&sG=~}@Gg* Input is a complex number with integer real and imaginary parts. The code is very inefficient. Its memory requirements increase exponentially with the …
Luis Mendo's user avatar
  • 105k
5 votes

N-Queens Puzzle

MATL, 33 32 27 bytes `x,GZ@]1Z?tt!P!,w&TXds]h1>a Try it online! Semi-brute force, non-determistic approach: Generate a random permutation of row positions Generate a random permutation of column …
Luis Mendo's user avatar
  • 105k
17 votes

Knight on the Rim is Grim

MATL, 17 14 13 12 bytes Thanks to @Neil for 1 byte off! 8:HZ^ZP5X^=s Input is 1-based. Try it online! Explanation This computes the Euclidean distance from the input to each of the 64 positions in th …
Community's user avatar
  • 1
5 votes

A Numpad's Knight Numbers

MATL, 38 37 29 bytes This uses @QPaysTaxes idea. I:8JK5:7Pvj!Uttnqh?)d|2:EQm}h The output is a 2D, complex, non-empty array. It is truthy if all its values have nonzero real part, and falsy otherwise …
Community's user avatar
  • 1
2 votes

Output all the white or black squares of a chessboard

MATL, 31 bytes 1)t3\8:t!++w4\~?H\]2#f2Y2!w)wVh Try it online!
Community's user avatar
  • 1