Minecraft 1.10.x, (削除) 924 (削除ここまで) 512 bytes
Thanks to @quat for reducing the blytecount by 48 points and the bytecount by 412.
Alright, so, I took some of the ideas from this answer and made a version of my own, except that this one is capable of accepting non-negative input. A version may be found here in structure block format.
(new version looks kinda boring tbh)
Similar commands as the other answer:
scoreboard objectives add a dummy
execute @e[type=Pig] ~ ~ ~ scoreboard players add m a 1
execute @e[type=Cow] ~ ~ ~ scoreboard players add n a 1
scoreboard players operation n a += m a
tellraw @a {"score":{"name":"n","objective":"a"}}
To input numbers, spawn in a number of cows and pigs. Cows will represent value "n" and pigs will represent value "m". The command block system will progressively kill the cows and pigs and assign values as necessary.
This answer assumes that you are in a world with no naturally occurring cows or pigs and that the values stored in "n" and "m" are cleared on each run.
- 11.3k
- 1
- 45
- 91