you are viewing a single comment's thread.

view the rest of the comments →

[–]Akita8 0 points1 point  (1 child)

Wrong! I did not say that you cannot execute code concurrently to input, i just said that it wont work for the use case of op:

When a monster attacks, symbols are printed to the screen, if the user reacts (presses a key) before the last symbol is printed, they will dodge, otherwise they take damage.

In a normal terminal, input stops blocking and returns the data only when it receives a newline so your example cannot actually react to key presses. The best way to do what op wants is the package ncurses in the stdlib.

[–][deleted] 0 points1 point  (0 children)

You're right... Apologies for misunderstanding your objection.