Minecraft 1.9.0+, 204 162 bytes + 58 36 28 24 20 blocks = 262 240 232 186 182 blytes
This solution is golfed down, and it can't be seen whole in one, or even two screenshots. Uses two glitches and abuses another two features of the game
This solution uses the same principles as the one below, just a 4 blocks more compact design.
Abuses the fact that Chain command blocks (green blocks) can't be powered by redstone, only by a singal from a impulse command block (orange).
Abuses the fact pistons take 0.30 seconds to extend completely, and redstone needs only 0.10s to register a signal.
Also abuses a twofold glitch to set the timer (TNT) off: the redstone next to the timer (TNT) gets not only powered, but also thinks the TNT is another redstone and powers it.
On top of all these abuses, the signal shortener (thing under the TNT) is one-use, after it gets powered it changes shape, allowing to pass signal through it to the "incrementer" (topmost orange block)
A bit of explanation on the functionality of it's different parts can be seen in older solutions (but best in the one just below). You can also Try it Offline! (simplified solution incrementing by 4, works only in 1.11+) by running this command in a command block.
Old solution, Minecraft 1.9.0+, 186 blytes:
Since TNT normally explode after 3.0s in Minecraft, this one has to be placed by a command (/setblock
) with a specified fuse. Also uses a more compact design to remove redundant command block (containing 42 bytes) and redstone against the older versions. I'm sure this can't get any lower...
Older solution, Minecraft 1.9.0+, 232 blytes:
Oops, I found out these older solutions increment by 4...
Uses the 1.9 command block chain feature (green block thing) to save blocks. Also uses a more compact signal shortener then in the older solutions
Even older solution, Minecraft 1.7.0+, 240 blytes:
Uses a more compact timer (TNT) then the first solution (below).
Oldest solution, Minecraft 1.7.0+, 262 blytes:
This is so long because of the way Minecraft handles variables:
To define a variable (int): scoreboard objectives add <variable> dummy
To set a value to a variable (each entity including players has it's own variable value): scoreboard players set <entity> <variable> <value>
*
can be used as <entity>
to select all entities and save bytes.
only defined variables may be used
the value of the variable must be set to a number, not a variable
To increment var1 by var2: scoreboard players operation <entity> var1 += <entity> var2
<entity>
must be a single entity, eg. @p
, not *
Screenshots are of my own, dual licenced under WTFPL and what licence SE decides to use today (currently cc by-sa 3.0 with attribution required
) :-)