在控制台中上移一行 (Pascal)
当其他人都在学习 Pascal 的基础知识时,我正坐在大学里制作一个圆圈和十字游戏。我可以将表示棋盘的 2D 数组打印到终端中,但我想要做的是每次玩家添加零或十字或移动光标时更新棋盘。为此,我想用新板覆盖旧板。有没有办法将控制台光标向上移动一行(顺便说一下Windoze控制台),或者我可以清除Pascal中的整个终端吗?
谢谢,
詹姆斯
Ps。这不是家庭作业。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您使用的 Pascal 风格,您也许可以使用
gotoxy()
。通常这将在 Pascal UNIT 中,例如 CRT,因此您需要在程序开始时使用USES CRT;
,例如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 aUSES CRT;
at the start of your program, e.g.