2
\$\begingroup\$

What I/O should be allowed for Minecraft commands answers? There is already this post, but it is mainly focused on redstone creations, and is quite outdated.

Here are some specific points, however, a general rule would be preferable:

  • Is it allowed to receive numerical input in a scoreboard you choose? If it is, are you responsible for creating the objective?
  • Is it allowed to output to a scoreboard?
  • Is it allowed to do I/O using a data storage?
  • Is it allowed to do numerical I/O in unary as the number of entities with some tag in the world?
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

My stance on Minecraft is the same as my stance on Baba is You. I absolutely encourage people to use Minecraft and other non-programming languages, for code-golf challenges, however I don't think they should be given special rules. Especially since it seems that these rules need to be updated when changes to the game break the existing rules.

That being said I think Minecraft commands can be used without special rules.

Output

Currently it is a consensus that programs may output by displaying it on screen.

That means that outputting to the Minecraft chat should be valid output. The following commands all do this:

/tellraw
/msg
/w
/say
/me

There are other commands that provide very specific output (e.g. /seed) these still are output since they print to the console but they aren't very useful for most code-golf so I'm not going to try to make a list of them.

Additionally the /title and /titleraw commands display text but as a title rather than in the chat. This is also valid output as it is displayed.

Now messages like these are not necessarily displayed to every player. I would say it is at least always valid to display the message to all players. And if it's command run by a single player (i.e. not run by a command block or the server), then it should be sufficient that the output display to that player.

Input

It seems to me that it is very hard for Minecraft commands to take input. It seems that the only valid method is (currently) hardcoding. Which means you can insert the input somewhere in the commands you are running. Note that you are only allowed to use this method if no other method is valid. I don't think it is possible to use /data to take input, because even though /data reads from a file it reads in a weird specific format, that I don't believe is flexible to allow you to take input on most challenges. For example I don't see how /data could be used to take an integer without special rules.

So this seems to be the current permitted form of input.

However if another method becomes valid or if I have overlooked some method that is already valid, this method will cease to be allowed and that method, no matter how cumbersome will be required.

I personally very much dislike this. I don't think this is good, but it is currently the consensus. If you would like to use Minecraft commands in a different way, I offer you the same option I offered for Baba is You:

If you want to do code-golf in Minecraft, you can write a programming language that works like Minecraft.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Why do you need specific rules for NBT? Isn't input generally formatted to make it possible for the language to read it? It seems to me like taking the input as binary NBT would be a reasonable input format \$\endgroup\$ Jul 13 at 10:09
  • 1
    \$\begingroup\$ The same for output, since it's allowed to output to a file \$\endgroup\$ Jul 13 at 10:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .