Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void
- tick_B(gamestate_t* gs)
- {
- bool added_cards_1to2 = false;
- bool added_cards_2to1 = false;
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- gs->move_count += 1;
- while (get_war_status(gs->stack1, gs->stack2) == war_pending) {
- if (gs->h1->size == 0) {
- if (added_cards_2to1 || gs->h2->size < 4) {
- gs->status = game_player2_win;
- return;
- }
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- added_cards_2to1 = true;
- } else if (gs->h2->size == 0) {
- if (added_cards_1to2 || gs->h1->size < 4) {
- gs->status = game_player1_win;
- return;
- }
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- added_cards_1to2 = true;
- } else if (gs->h1->size == 1) {
- if (added_cards_2to1 || gs->h2->size < 3) {
- gs->status = game_player2_win;
- return;
- }
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- added_cards_2to1 = true;
- } else if (gs->h2->size == 1) {
- if (added_cards_1to2 || gs->h1->size < 3) {
- gs->status = game_player1_win;
- return;
- }
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- added_cards_1to2 = true;
- } else {
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h1), gs->stack1);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- cardstack_push_bottom(hand_pop_top(gs->h2), gs->stack2);
- }
- gs->move_count += 2;
- }
- if (get_war_status(gs->stack1, gs->stack2) == war_player1_won) {
- if (gs->h2->size == 0) {
- gs->status = game_player1_win;
- return;
- }
- gs->return_procedure(gs->stack1, gs->stack2, gs->h1);
- }
- if (get_war_status(gs->stack1, gs->stack2) == war_player2_won) {
- if (gs->h1->size == 0) {
- gs->status = game_player2_win;
- return;
- }
- gs->return_procedure(gs->stack2, gs->stack1, gs->h2);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement