Removed all move_t stuff because it was not implemented and anything other than putting got broken in the previous commit

This commit is contained in:
AnnaSnoeijs 2025-06-06 21:31:59 +02:00
parent 8810175693
commit 355c79bac4
7 changed files with 39 additions and 156 deletions

View file

@ -132,28 +132,14 @@ void initBoard( const board_t board ){
void updateBoard(
const wins_t wins,
const board_t board,
const move_t move,
const int column
){
int height = board.height[ column ];
switch( move ){
case PUT:
mvaddstr(
BOARD_Y + BOARD_DY * ( board.rows - height + 1 ),
BOARD_X + 1 + BOARD_DX * ( column + 1 ),
board.column[ column ] & 1 << ( height - 1 ) ? "1" : "0"
);
break;
default:
for( int row = 0; row < height; row++ ){
mvaddstr(
BOARD_Y + BOARD_DY * ( board.rows - row ),
BOARD_X + 1 + BOARD_DX * ( column + 1 ),
board.column[ column ] & 1 << row ? "1" : "0"
);
}
break;
}
mvaddstr(
BOARD_Y + BOARD_DY * ( board.rows - height + 1 ),
BOARD_X + 1 + BOARD_DX * ( column + 1 ),
board.column[ column ] & 1 << ( height - 1 ) ? "1" : "0"
);
char num[4];
sprintf( num, "%3d", wins.count0.vertical );
mvaddstr(
@ -218,8 +204,7 @@ void updateBoard(
}
int askColumn(
const board_t board,
const move_t move
const board_t board
){
int column = 0;
#ifdef ARROWS
@ -244,33 +229,15 @@ int askColumn(
case KEY_DOWN:
return column;
}
switch( move ){
case PUT:
for(; board.height[ column ] >= board.rows; ) switch( ch ){
case KEY_RIGHT:
if( column >= board.columns ) ch = KEY_LEFT;
else column++;
break;
case KEY_LEFT:
if( column == 0 ) ch = KEY_RIGHT;
else column--;
break;
}
for(; board.height[ column ] >= board.rows; ) switch( ch ){
case KEY_RIGHT:
if( column >= board.columns ) ch = KEY_LEFT;
else column++;
break;
case POP:
for(; board.height[ column ] <= 0; ) switch( ch ){
case KEY_RIGHT:
if( column >= board.columns ) ch = KEY_LEFT;
else column++;
break;
case KEY_LEFT:
if( column == 0 ) ch = KEY_RIGHT;
else column--;
break;
}
case KEY_LEFT:
if( column == 0 ) ch = KEY_RIGHT;
else column--;
break;
default:
// Do nothing
}
}
#else /* !ARROWS */
@ -282,14 +249,7 @@ int askColumn(
);
if( board.player ) addstr( "1" );
else addstr( "0" );
switch( move ){
case PUT:
addstr( " put the piece? " );
case POP:
addstr( " pop a piece? " );
default:
addstr( " Undefined move a thingy? " );
}
addstr( " put the piece? " );
clrtoeol();
refresh();
scanw( " %d", &column );
@ -300,30 +260,14 @@ int askColumn(
);
clrtoeol();
if( column >= 0 && column < board.columns )
switch( move ){
case PUT:
if( board.height [ column ] < board.columns )
return column;
else addstr( "Pls enter a column that ain't full" );
break;
case POP:
if( board.height [ column ] != 0 )
return column;
else addstr( "Pls enter a column that ain't empty" );
default:
return column;
}
if( board.height [ column ] < board.columns )
return column;
else addstr( "Pls enter a column that ain't full" );
else addstr( "Pls enter a column that exists" );
}
#endif /* ! ARROWS */
}
move_t askMove( void ){
move_t move = PUT;
// TODO: actually ask what move
return move;
}
#undef INPUT_X
#undef INPUT_Y
#undef SCOREBOARD_X