Hot answers tagged

1190 votes

Build a working game of Tetris in Conway's Game of Life

This began as a quest but ended as an odyssey. Quest for Tetris Processor, 2,940,928 x 10,295,296 The pattern file, in all its glory, can be found here, viewable in-browser here. This project is the ...
830 votes

Build a working game of Tetris in Conway's Game of Life

Part 2: OTCA Metapixel and VarLife OTCA Metapixel (Source) The OTCA Metapixel is a construct in Conway's Game of Life that can be used to simulate any Life-like cellular automata. As the LifeWiki (...
El'endia Starman's user avatar
795 votes

Build a working game of Tetris in Conway's Game of Life

Part 3: Hardware With our knowledge of logic gates and the general structure of the processor, we can start designing all the components of the computer. Demultiplexer A demultiplexer, or demux, is ...
K Zhang's user avatar
  • 7,056
754 votes

Build a working game of Tetris in Conway's Game of Life

Part 4: QFTASM and Cogol Architecture Overview In short, our computer has a 16-bit asynchronous RISC Harvard architecture. When building a processor by hand, a RISC (reduced instruction set computer)...
PhiNotPi's user avatar
  • 28.9k
707 votes

Build a working game of Tetris in Conway's Game of Life

Part 6: The Newer Compiler to QFTASM Although Cogol is sufficient for a rudimentary Tetris implementation, it is too simple and too low-level for general-purpose programming at an easily readable ...
Blue's user avatar
  • 28.5k
81 votes

Magic the Gathering: Friends or Foes?

JavaScript (ES6),  26 23 17 15  14 bytes Takes input as two ASCII codes in currying syntax (a)(b). Returns 4 for ...
Arnauld's user avatar
  • 186k
78 votes

Score rock-paper-scissors

Groovy, 67 56 50 Bytes {a,b->Math.sin(1.3*((int)b[0]-(int)a[0])).round()} Try it online! Turns out that the rock, paper, scissors game has a pretty cool ...
Magic Octopus Urn's user avatar
66 votes

Cheat at Rock-Paper-Scissors-Lizard-Spock

Perl 6, 36 30 bytes {<Spock Lizard Rock>[.comb%4]} Try it online! Gets each output based on the length of the input modulo 4. I think this is probably the ...
Jo King's user avatar
  • 47k
61 votes

Rock, Polyglot, Scissors

Python, brainfuck and JavaScript, 103 99 bytes Yay under 100 bytes! ...
Loovjo's user avatar
  • 8,100
44 votes

Score rock-paper-scissors

C, 50 35 bytes #define f(i)*(short*)(i+7)%51%4%3-1 Call f with a string containing both players, without separator, and it ...
Quentin's user avatar
  • 1,187
41 votes

Rock, Polyglot, Scissors

Python 2, Ruby, Retina, 90 83 bytes -7 bytes thanks to Value Ink s=['rock','paper','scissors'] print s[s.index((0and gets or input()))+(0and-2or-1)] Try it ...
math junkie's user avatar
  • 7,227
36 votes

Magic the Gathering: Friends or Foes?

Python 2, 19 bytes "WUBRGWGRBUW".count Try it online! An anonymous function: returns 1 for friends and ...
Lynn's user avatar
  • 67.9k
36 votes

Magic the Gathering: Friends or Foes?

Jelly, 6 bytes ạg105Ị Takes two code points as argument. Yields 1 for friends, 0 for foes. Try it online! Background Let n and m be the code points of two ...
Dennis's user avatar
  • 209k
32 votes

Google's doodle on kids coding: shortest program solving all the levels

Not my answer 6 blocks The user Alex found a shorter solution, of length 6. I can confirm that their solution works: O(O(Br G G, 6) Br, 5) They attempted to ...
Reinis Mazeiks's user avatar
29 votes

Choose The Powerball Numbers!

Dyalog APL, 10 bytes (5?69),?26 Dyadic ? is ⍺ distinct random numbers in [1,⍵], and monadic ...
lirtosiast's user avatar
  • 21.4k
29 votes

Yahtzee Small Straight Detection

MATL, 7 12 11 9 8 6 bytes Thanks a lot to @lirtosiast for removing 2 bytes ud7BXf Truthy is an array of nonzero values. Falsy is empty array (no output displayed). ...
Luis Mendo's user avatar
  • 104k
27 votes

Is my Diffy game degenerate?

Pyth, 6 bytes suaV+e Test suite This program is very suave. 0 (falsy) means all zeroes, anything else (truthy) means not all zeroes. How it works: ...
isaacg's user avatar
  • 41.7k
24 votes

Count without 3

Brachylog, 10 bytes <.='e3:I'* Try it online! Explanation ...
Fatalize's user avatar
  • 38.3k
24 votes

Super Mario 64 RNG

x86 32-bit machine code, 21 bytes 89 C8 30 C4 86 C4 D1 E8 73 04 66 35 74 9E 66 35 74 E0 30 C8 C3 Try it online! Uses the ...
m90's user avatar
  • 9,411
23 votes

Invert a Minesweeper Board

CJam, 58 57 bytes 0WX]2m*qN/{'*f+z}2*f{\~@m<fm<W<}:..+{W<{_'*#'*@'*-,?}/N}/ Input should not end with a linefeed. Output contains ...
Dennis's user avatar
  • 209k
22 votes

A game of dice, but avoid number 6

NeoBot Instead, only try to realize the truth - there is no spoon NeoBot peeks into the matrix (aka random) and predicts if the next roll will be a 6 or not - it can't do anything about being handed ...
Mostly Harmless's user avatar
21 votes

Magic the Gathering: Friends or Foes?

Befunge-98, 13 12 bytes ~~-9%5%3%!.@ Try it online! Prints 0 for friends and 1 for foes ...
MercyBeaucou's user avatar
  • 3,061
21 votes

Rock, Polyglot, Scissors

V, Brain-flak, and Python 2, 97, 86, 81, 77, 75 bytes o='rock paper scissors'.split() lambda s:o[o.index(s)-1]#ddt.C rHd*wywVp Two bytes saved ...
DJMcMayhem's user avatar
  • 58.7k
20 votes

The Combinatorics of Transistor

CJam (56 bytes) q~4@:Nm*:$_&{:+1$\-N),&},f{1$1$:+-\0-:(_e`0f=+++:m!:/}:+ Online demo This is an optimised version of the reference implementation I ...
Peter Taylor's user avatar
  • 43.1k
20 votes

Tool-Assisted Code Golf

Python 2, 69 48 46 44 bytes print"start\n\n"*19+(27*"A right\n"+"\n")*99 See it in action on youtube! Automatically found with (a modified version of) this ...
orlp's user avatar
  • 39k
20 votes

Formic Functions - Ant Queen of the Hill Contest

Forensic Ants All my answers are sharing the same set of low-level helper functions. Search for "High-level logic begins here" to see the code specific to this answer. ...
Dave's user avatar
  • 8,431

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