Teaching my kid how to program and using Nim as an alternative to Python.

Trying to write simple games that output to stdout in windows terminal. But 
echoing rows of strings, sleeping, and repeating results in the text flowing 
onto the terminal too slowly, so it appears to be hopping around as it fills in 
before sleeping. I've done this same sort of thing in Python on my Mac with no 
visual issues.

I'm wondering if this is a windows terminal issue or if there's a better way to 
dump a bunch of text out of Nim between ticks. My first thought was to buffer 
my rows of strings to some temporary space and then echo the entire game screen 
all at once, but I was either approaching it the wrong way of else windows 
terminal is too slow to write multiple rows quickly without visual glitches.

This is easily reproduced by creating a simple Nim program that dumps the 
alphabet to the terminal, inserting a newline every x characters, sleeping for 
0.5 seconds using os.sleep, and clearing the screen using terminal.eraseScreen; 
all in a loop.

Anyone have advice on how to accomplish a terminal based game in Nim? Thanks in 
advance!

Reply via email to