Skip to main content
16 votes

Draw me a domino

Python 2, 101 97 92 68 64 bytes lambda*a:[[[n>3,n>5,n>1],[n>7,n%2,n>7],[n>1,n>5,n>3]]for n in a] Try it online! Credits Reduced from 101 ...
Neil's user avatar
  • 2,525
14 votes

Triangular domino tiling of an almost regular hexagon

APL (Dyalog Classic), 14 bytes ×/1+1÷1+∘,1⊥¨⍳ Try it online! Uses 0 indexing with ⎕IO←0. Explanation: ...
Jo King's user avatar
  • 47.2k
13 votes

Draw me a domino

C (gcc), 252 242 269 262 241 235 220 bytes I was on stack overflow for sockets in python, when this popped up, said why not? first code golf, so i'm not entirely sure if I followed the rules 100% (...
Andrew Baumher's user avatar
13 votes

Topple some dominoes!

Retina, 32 bytes +`(/.\\)|(/)\||\|(\\) $1$2$2$3$3 Try it online! Explanation The + tells Retina to run the replacement in a ...
Martin Ender's user avatar
10 votes

Draw me a domino

Jelly, 20 bytes “¤o.ƤẸʠṚ’B¬s5ŒBị@s€3 Try it online! Alternate version, original output, 33 32 31 bytes ...
Dennis's user avatar
  • 210k
10 votes

How many dominoes can you fit here?

Python 3.8 (pre-release), 544 bytes ...
lynn's user avatar
  • 68.8k
9 votes

Draw me a domino

Perl 5, 107 76 70 67 + 1 (-a) = 67 bytes ...
Xcali's user avatar
  • 15.3k
9 votes

Draw me a domino

Jelly, 13 bytes ⁽½ÑD<;ḂŒBs3µ€ Try it online! Combining Dennis' idea of using ŒB (bounce) in this answer and Xcali's ...
DELETE_ME's user avatar
  • 17.3k
8 votes

Triangular domino tiling of an almost regular hexagon

Perl 6, 38 30 bytes {[*] map 1+1/(*+1),[X+] ^<<@_} Try it online! Based on the formula given in the question Explanation: ...
Jo King's user avatar
  • 47.2k
8 votes

Maximal saturated domino covering of a rectangle

Sagemath, 60 bytes lambda m,n:m*n-len(graphs.GridGraph([m,n]).dominating_set()) Try it online! From Saturated Domino Coverings by Buchanan et al: Corollary 6.3: ...
Sisyphus's user avatar
  • 14.8k
6 votes

Draw me a domino

PHP 155, 150 bytes ...
ArtisticPhoenix's user avatar
6 votes

Draw me a domino

JavaScript (ES6), 79 78 bytes Saved 1 byte thanks to @ETHproductions Takes input in currying syntax (a)(b) and outputs a vertical ASCII domino. ...
Arnauld's user avatar
  • 193k
6 votes

How many dominoes can you fit here?

Jelly, 216 199 bytes ...
Nick Kennedy's user avatar
  • 21.1k
5 votes

Topple some dominoes!

Python 2, 115 114 111 108 98 95 bytes -1 byte thanks to ovs a=input() for i in range(4)*len(a):a=a.replace('//|x||\ \\'[i::4],'/\/x|\/ \\'[3-i::4]) print a Try ...
Rod's user avatar
  • 18.4k
5 votes

Triangular domino tiling of an almost regular hexagon

Jelly, 9 8 bytes Œp§_2İ‘P Try it online! Uses the altered form of the closed form expression. Takes input as a list [x,y,z]. ...
Unrelated String's user avatar
5 votes

Triangular domino tiling of an almost regular hexagon

K (ngn/k), 17 15 bytes %/*/'2 1+\:+/!: Try it online! last test fails because of an overflow uses a 0-indexed version of the formula: \$PL(x,y,z)=\prod_{i=0}^{x-1}\...
ngn's user avatar
  • 15.3k
5 votes

Triangular domino tiling of an almost regular hexagon

Wolfram Language (Mathematica), 28 bytes Array[1+1/(##-2)&,#,1,1##&]& Try it online!
alephalpha's user avatar
  • 48.5k
5 votes

Triangular domino tiling of an almost regular hexagon

Haskell, 44 bytes foldr(\r k->k+k/(sum r-2))1.mapM(\n->[1..n]) Try it online! Outputs floats. Thanks to @H.PWiz for 4 bytes using a fold.
xnor's user avatar
  • 145k
5 votes

Triangular domino tiling of an almost regular hexagon

05AB1E, 13 11 bytes L.«â€˜OÍz>P Try it online or verify all test cases. Explanation: Uses the derived formula (inspired by @JoKing's answers): $$PL(x,y,z) = \...
Kevin Cruijssen's user avatar
5 votes

Domino Recurrence Generator

APL (Dyalog Unicode), 72 bytes {⍵=1:⍳2⋄(2*⌈⍵÷2)(⌷⌹⍉⍤↑)⍉L↑⍉↑,¨+.×\(L←2*⍵)⍴⊂∘.((0∊+)⍱1∊2|×≢¨⍤⊆⊣)⍨⍸1⍴⍨⍵⍴2} Try it online! (uses a polyfill for ⍤ since TIO is not ...
fireflame241's user avatar
  • 16.3k
5 votes

Counting polydominoes

Ruby, 266 250 242 bytes ...
G B's user avatar
  • 22.1k
4 votes

Longest domino chain

Mathematica, 191 bytes ...
Greg Martin's user avatar
  • 15.8k
4 votes

Longest domino chain

Brachylog, 29 bytes v0|sp:{|r}aLcbk@b:{l:2%0}a,Ll Try it online! Pretty sure this is awfully long, but whatever. This is also awfully slow. Explanation ...
Fatalize's user avatar
  • 38.8k
4 votes

Draw me a domino

APL (Dyalog), 25 bytes 2∘|(3 3⍴⊢,,∘⌽)¨>∘3 5 1 7¨ Try it online! -2 thanks to ngn. The output format is a little bit weird: this function returns an array ...
Erik the Outgolfer's user avatar
4 votes

Draw me a domino

C (gcc), 115 113 bytes -2 bytes thanks to ceilingcat ...
gastropner's user avatar
  • 4,373
4 votes

Topple some dominoes!

V, 23 bytes òÓ¯À<!|¨Ü©ü¨¯©|ÜÀ!/±±²² Try it online! Really, this is very similar to the retina answer, just that it looks uglier. Uses regex compression. ...
DJMcMayhem's user avatar
  • 59.3k
4 votes

Topple some dominoes!

SNOBOL4 (CSNOBOL4), 117 115 112 111 bytes ...
Giuseppe's user avatar
  • 28.6k
4 votes

Maximal saturated domino covering of a rectangle

JavaScript (ES6), 120 bytes A shorter (and slower) version, using the same algorithm with eval() and two for loops. Expects <...
Arnauld's user avatar
  • 193k
3 votes

Which dominoes are missing?

Julia 0.6, 47 bytes A->setdiff([[i,j]for i=0:6 for j=i:6],sort.(A)) Try it online! (Corrected range start thanks to JayCe.) 48 bytes ...
Sundar R's user avatar
  • 6,612

Only top scored, non community-wiki answers of a minimum length are eligible