aboutsummaryrefslogtreecommitdiff
path: root/lib/libncurses
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-08-15 20:15:18 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-08-15 20:15:18 +0000
commitd1dd4d6ef0997c74f9398bcd5a8a789dad49e570 (patch)
tree2d3b596511f7f99c54b3f96290403f49438e87e6 /lib/libncurses
parentde71b88098143c443ed03ff4b96b8faaded9d0a4 (diff)
Notes
Diffstat (limited to 'lib/libncurses')
-rw-r--r--lib/libncurses/TESTS/hanoi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libncurses/TESTS/hanoi.c b/lib/libncurses/TESTS/hanoi.c
index bf44cc48cc61..8a482d5655c9 100644
--- a/lib/libncurses/TESTS/hanoi.c
+++ b/lib/libncurses/TESTS/hanoi.c
@@ -51,13 +51,14 @@ int TileColour[] = {
};
int NMoves = 0;
+static unsigned char AutoFlag;
+
void InitTiles(), DisplayTiles(), MakeMove(), AutoMove(), Usage();
int
main(int argc, char **argv)
{
int NTiles, FromCol, ToCol;
-unsigned char AutoFlag = 0;
switch(argc) {
case 1:
@@ -117,6 +118,10 @@ unsigned char AutoFlag = 0;
for(;;) {
if(GetMove(&FromCol, &ToCol))
break;
+ if (AutoFlag) {
+ AutoMove(0, 2, NTiles);
+ break;
+ }
if(InvalidMove(FromCol, ToCol)) {
mvaddstr(STATUSLINE, 0, "Invalid Move !!");
refresh();
@@ -209,6 +214,10 @@ GetMove(int *From, int *To)
refresh();
if((*From = getch()) == 'q')
return TRUE;
+ else if (*From == 'a') {
+ AutoFlag = TRUE;
+ return FALSE;
+ }
*From -= ('0'+1);
addstr(" to ");
clrtoeol();