3
3strands
Hi!
I am writing a C++ program for a school project. It's a project and I
could do it without this particualr feature, it's just it would be
better if I could find out one thing:
I'm making a simple game to simulate the rabbit vs. tortoise race. I
need to print a race track on the screen like so:
###############R######
#######T##############
It would be nice if, instead of having to reprint the next tick of the
clock in the race it under the previous line:
#################R####
####T#################
###############R###### SLIPPED!
#######T##############
, which would mean that it would be constantly scrolling, if there was
a way to simply rewrite that exact line on the screen.
So this would be printed:
#################R####
####T#################
The die would roll and moves would be calculated, then the cursor would
be moved up and this would be printed "over" the old racetrack image
###############R###### SLIPPED!
#######T##############
without all of the constant scrolling down the console for each tick of
the clock.
Is there a way to print a reverse newline character so that I could
move the cursor *backwards* up the screen? A newline character moves
it down one line, so is there a way to move the cursor up a line? I've
researched it on the web for a while When I learned PERL (my first
langauge) I tried to find out how to do it then, too, but never could
find anything online or in books about it. So I'm wondering if anyone
could help?
JII
I am writing a C++ program for a school project. It's a project and I
could do it without this particualr feature, it's just it would be
better if I could find out one thing:
I'm making a simple game to simulate the rabbit vs. tortoise race. I
need to print a race track on the screen like so:
###############R######
#######T##############
It would be nice if, instead of having to reprint the next tick of the
clock in the race it under the previous line:
#################R####
####T#################
###############R###### SLIPPED!
#######T##############
, which would mean that it would be constantly scrolling, if there was
a way to simply rewrite that exact line on the screen.
So this would be printed:
#################R####
####T#################
The die would roll and moves would be calculated, then the cursor would
be moved up and this would be printed "over" the old racetrack image
###############R###### SLIPPED!
#######T##############
without all of the constant scrolling down the console for each tick of
the clock.
Is there a way to print a reverse newline character so that I could
move the cursor *backwards* up the screen? A newline character moves
it down one line, so is there a way to move the cursor up a line? I've
researched it on the web for a while When I learned PERL (my first
langauge) I tried to find out how to do it then, too, but never could
find anything online or in books about it. So I'm wondering if anyone
could help?
JII