*
* Date: 05.Nov.90
*
- * $Id: hanoi.c,v 1.14 1997/05/06 23:07:55 tom Exp $
+ * $Id: hanoi.c,v 1.16 1999/10/23 15:01:01 tom Exp $
*/
#include <test.priv.h>
fprintf(stderr, "Min screen length 24 lines\n");
return EXIT_FAILURE;
}
- if(AutoFlag)
+ if(AutoFlag) {
+ curs_set(0);
leaveok(stdscr, TRUE); /* Attempt to remove cursor */
+ }
InitTiles(NTiles);
DisplayTiles();
if(AutoFlag) {
}
}
}
- curs_set(1);
endwin();
return EXIT_SUCCESS;
}
static void
DisplayTiles(void)
{
- int Line, Peg, SlotNo;
+ int Line, peg, SlotNo;
char TileBuf[BUFSIZ];
erase();
attrset(A_NORMAL);
/* Draw tiles */
- for(Peg=0; Peg<NPEGS; Peg++) {
- for(SlotNo=0; SlotNo<Pegs[Peg].Count; SlotNo++) {
- memset(TileBuf, ' ', Pegs[Peg].Length[SlotNo]);
- TileBuf[Pegs[Peg].Length[SlotNo]] = '\0';
+ for(peg=0; peg<NPEGS; peg++) {
+ for(SlotNo=0; SlotNo<Pegs[peg].Count; SlotNo++) {
+ memset(TileBuf, ' ', Pegs[peg].Length[SlotNo]);
+ TileBuf[Pegs[peg].Length[SlotNo]] = '\0';
if (has_colors())
- attrset(COLOR_PAIR(LENTOIND(Pegs[Peg].Length[SlotNo])));
+ attrset(COLOR_PAIR(LENTOIND(Pegs[peg].Length[SlotNo])));
else
attrset(A_REVERSE);
mvaddstr(BASELINE-(SlotNo+1),
- (int)(PegPos[Peg] - Pegs[Peg].Length[SlotNo]/2),
+ (int)(PegPos[peg] - Pegs[peg].Length[SlotNo]/2),
TileBuf);
}
}