views:

29

answers:

1

Hey all.

I'm sitting at college making a noughts and crosses game while everyone else is learning the basics of Pascal. I can print the 2D array denoting the board into the terminal just fine, but what I want to do is update the board everytime a player adds a nought or cross, or moves their cursor around. To do this, I want to over-write the old board with the new one. Is there a way to move the console cursor up one line (Windoze console by the way), or can I clear the entire terminal in Pascal?

Thanks,

James

Ps. This is NOT homework.

+1  A: 

Depending on what flavour of Pascal you are using you may be able to use gotoxy(). Typically this will be in a Pascal UNIT such as CRT, so you'll need a USES CRT; at the start of your program, e.g.

PROGRAM main;

USES CRT;

BEGIN
  gotoxy(10, 10);
  writeln('Hello world!');
END.
Paul R
I tried various ways of typing in "uses crt" and it gave me compile errors. I'm using this crappy Embarcadero or something IDE, which might mean it has it's own libraries. Thanks anyway though :) EDIT: it's the right answer; I've seen it all over lol.
JamWaffles