I/O console or canvas entity #683
Labels
C-Low Hanging Fruit
Ideal issue for new contributors.
L-Commands
Built-in commands (e.g. move, try, if, ...) in the Swarm language.
L-Language design
Issues relating to the overall design of the Swarm language.
S-Nice to have
The bug fix or feature would be nice but doesn't currently have much negative impact.
T-UI
Involves the user interface.
Z-Feature
A new feature to be added to the game.
My original motivation was contemplating the idea of sending robots into places you can't see (off the screen, into structures #112 or sub-worlds #144 ...) and programming them to wander around, build a map of the area (probably using some kind of mutable array #98 ), then come back and give you the map. How would you actually view the resulting map?
I propose having a "virtual I/O console" (perhaps in a different "tab" in the same window as the world view, so you can switch back and forth between them, or perhaps in the same window as the REPL) and adding some commands to output to the console. One might think of adding built-in commands like
putStr
, but actually, since I'd like to keep the number of new primitives to a minimum, and because I want to be able to do cool things like draw color maps, we might contemplate going even lower-level like a command to set the color and a command to put a character at a specific (row,column) position. Then you could build your own functions likeputStr
on top of that.I am not sure how reading keyboard input would work, or whether we should, but just doing output to the virtual console seems like a good place to start.
Edit: a simpler, useful thing to start could be just a simple command like
print : text -> cmd unit
(and perhaps aninput : cmd text
to go with it) which outputs (respectively, reads) a string from the REPL console. This wouldn't be as useful for printing maps etc. but it would be useful for displaying information, debugging, etc. Edit 2: not sure how usefulprint
/input
would be on their own anymore, since we havelog
for outputting information and key input handlers for (a limited form of) input.The text was updated successfully, but these errors were encountered: