# Shortest way to make a checkerboard pattern

I'm looking for the shortest (in terms of characters) code snippet to make an n-square checkerboard. Here's my first try (comes in at 72 characters):

Graphics@{PatternFilling["Checkerboard", ImageScaled[1/10]],
Rectangle[]}


And my second try, which is a bit shorter (42 characters):

Image @ Table[.5 + (-1)^(i + j)/2, {i, 10}, {j, 10}]


• Graphics@{"Checkerboard"~PatternFilling~ImageScaled[1/10],Rectangle[]} would shave off 1 character… Commented Sep 29, 2020 at 19:58
• 52 characters: Graphics@{PatternFilling@"Checkerboard",Rectangle[]}
– kglr
Commented Sep 29, 2020 at 21:45
• Commented Sep 30, 2020 at 7:20
• Mathematica ought to help us find the shortest code to do the job! After all, computer systems are supposed to do work for us, not the other way around. Commented Oct 6, 2020 at 19:41

28 characters:

Image@Array[(-1)^+## &, {8, 8}]


12 key strokes:

=chess board


• Wow and i thought @boomboom answer is unshortable :-) Cool stuff. Commented Sep 29, 2020 at 21:09
• You should post this as an answer to the code golf question, it beats Martin Ender's 34-byte answer. If the Wolfram Alpha version is acceptable, it beats the current shortest answer. Commented Sep 30, 2020 at 5:58
• Image[(-1)^ToeplitzMatrix@8] Commented Jan 27 at 10:32

Try Image[Array[Mod[#+#2,2]&,{8,8}]]

• You can use @ rather than [...] to save 1 character Commented Sep 29, 2020 at 20:01
• .Image@Array[Mod[+##,2]&,{8,8}] saves two characters.
– kglr
Commented Sep 29, 2020 at 20:19