Currently i have the move left function
int8_t move_piece_left(piece_type* piecePtr) {
int8_t row;
/*
* Check if piece is all the way to the left If so, return.
* (Remember, column number is based on bit position - higher
* numbers to the left.
*/
if(piecePtr->right_column + piecePtr->x_dimension >= BOARD_WIDTH) {
return 0;
}
/*
* Make the move.
*/
for(row=0; row < piecePtr->y_dimension; row++) {
piecePtr->rowdata[row] <<= 1;
}
piecePtr->right_column++;
return 1;
}
I assumed for the move right it would be a simple change, which I am sure it is but I don't think its going so well. So obviously I need to check if the piece is all the way to the right not the left, and perhaps its
piecePtr->right_column--;
To move right since left is ++ right would be -- I think?
I've tried a few changes here and there but not much has worked, so I am beginning to think I'm not fully understanding the code.
Can someone give a more of a deeper explain what the code is doing (I can read the comments I wanted a more of an in depth explanation).
EDIT there are appropriate checks in order to move left or right. e.g. checking if a piece is there