Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I/O console or canvas entity #683

Open
byorgey opened this issue Sep 13, 2022 · 2 comments
Open

I/O console or canvas entity #683

byorgey opened this issue Sep 13, 2022 · 2 comments
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.

Comments

@byorgey
Copy link
Member

byorgey commented Sep 13, 2022

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 like putStr 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 an input : 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 useful print/input would be on their own anymore, since we have log for outputting information and key input handlers for (a limited form of) input.

@byorgey byorgey added Z-Feature A new feature to be added to the game. C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. L-Language design Issues relating to the overall design of the Swarm language. T-UI Involves the user interface. labels Sep 13, 2022
@xsebek
Copy link
Member

xsebek commented Sep 14, 2022

To tie it back to the map idea, maybe you could "place entities" on some (finite) canvas?

You would not actually put the entity there, just print the entity character with its attributes.

So the resulting command could be print :: entity -> (int*int) -> entity -> cmd () where the entity type is from #455 and the third argument would be the particular "map canvas" in inventory.

@byorgey byorgey mentioned this issue Sep 15, 2022
@byorgey byorgey changed the title I/O console I/O console or canvas entity Oct 7, 2022
@byorgey byorgey added C-Low Hanging Fruit Ideal issue for new contributors. and removed C-Moderate Effort Should take a moderate amount of time to address. labels Mar 13, 2023
@byorgey
Copy link
Member Author

byorgey commented Mar 13, 2023

The "canvas" idea is cool, but it seems like that would require doing #455 first; at the current rate I don't know how soon that will actually happen. For now it seems like it could be a relatively straightforward, "low hanging fruit"-type task to add a couple commands to print to the virtual console and then make a way to visualize it in the UI.

@byorgey byorgey added the L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants
@byorgey @xsebek and others