Skip to content
Snippets Groups Projects
Commit 4f27362e authored by Bariatti Francesco's avatar Bariatti Francesco
Browse files

Implemented score update in play() with arrays

parent 89b75ea6
No related branches found
No related tags found
No related merge requests found
......@@ -280,37 +280,36 @@ namespace game
}
// ADD PENGUIN TILE TO THE SCORE
/*
//TODO: implements methods with arrays
if ((state.one_fish >> position) & 1)
#define POS(penguin) ((penguin) & 63)
if((state.one_fish >> POS(*peng)) & 1) //If there is a one fish on this position
{
if(current_player() == RED)
if(state.current_player_red)
state.score_red += 1;
else
state.score_blue += 1;
//We replace this tile with an empty one (0 in the bitboard)
state.one_fish = state.one_fish & ~(((uint64_t) 1) << position);
state.one_fish = state.one_fish & ~(((uint64_t) 1) << POS(*peng));
}
else if ((state.two_fish >> position) & 1)
else if((state.two_fish >> POS(*peng)) & 1)
{
if(current_player() == RED)
if(state.current_player_red)
state.score_red += 2;
else
state.score_blue += 2;
//We replace this tile with an empty one (0 in the bitboard)
state.two_fish = state.two_fish & ~(((uint64_t) 1) << position);
state.two_fish = state.two_fish & ~(((uint64_t) 1) << POS(*peng));
}
else
{
if(current_player() == RED)
if(state.current_player_red)
state.score_red += 3;
else
state.score_blue += 3;
//We replace this tile with an empty one (0 in the bitboard)
state.three_fish = state.three_fish & ~(((uint64_t) 1) << position);
state.one_fish = state.one_fish & ~(((uint64_t) 1) << POS(*peng));
}
/*
//TODO: implements methods with arrays
//Move the current penguin
move_penguin(p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment