Expanded move_t type with QUIT and added MOVECOUNT
This commit is contained in:
parent
7bbd877fb5
commit
2d11458586
4 changed files with 16 additions and 3 deletions
1
logic.c
1
logic.c
|
|
@ -52,6 +52,7 @@ void playMove(
|
|||
case POP: // Pop out the lowest and make all above fall down
|
||||
boardptr->column [ column ] >>= 1;
|
||||
boardptr->height [ column ]--;
|
||||
default: // Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
4
types.h
4
types.h
|
|
@ -5,8 +5,10 @@
|
|||
#include "config.h"
|
||||
|
||||
typedef enum {
|
||||
QUIT=0,
|
||||
PUT,
|
||||
POP
|
||||
POP,
|
||||
MOVECOUNT
|
||||
} move_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ int askColumn(
|
|||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
|
@ -286,6 +287,8 @@ int askColumn(
|
|||
addstr( " put the piece? " );
|
||||
case POP:
|
||||
addstr( " pop a piece? " );
|
||||
default:
|
||||
addstr( " Undefined move a thingy? " );
|
||||
}
|
||||
clrtoeol();
|
||||
refresh();
|
||||
|
|
@ -307,6 +310,8 @@ int askColumn(
|
|||
if( board.height [ column ] != 0 )
|
||||
return column;
|
||||
else addstr( "Pls enter a column that ain't empty" );
|
||||
default:
|
||||
return column;
|
||||
}
|
||||
else addstr( "Pls enter a column that exists" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ int askColumn(
|
|||
case PUT: printf( "Wher player %d put? ", board.player );
|
||||
break;
|
||||
case POP: printf( "Wher player %d pop? ", board.player );
|
||||
break;
|
||||
default: printf( "Wher player %d do the thing? ", board.player );
|
||||
}
|
||||
printf( "\033[K" ); // clear everything after cursor
|
||||
fflush( stdout );
|
||||
|
|
@ -149,6 +151,9 @@ int askColumn(
|
|||
if( board.height [ column ] != 0 )
|
||||
return column;
|
||||
else printf( "\033[2Apls enter a column that ain't empty" );
|
||||
break;
|
||||
default:
|
||||
return column;
|
||||
}
|
||||
else
|
||||
printf( "\033[2Apls enter valid column" );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue