Add something so that you can solve the puzzle automatically by pressing

`a' (I'm using this code as a test for something else, and just happened
to add this in the process :).
This commit is contained in:
Jordan K. Hubbard 1996-08-15 20:15:18 +00:00
parent de71b88098
commit d1dd4d6ef0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17612

View file

@ -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();