Bug 509 - The first player should not skip the first turn
Summary: The first player should not skip the first turn
Status: RESOLVED FIXED
Alias: None
Product: 2021A-CS3343-Gp17-Big2PokerGame
Classification: Unclassified
Component: GameController (show other bugs)
Version: 1.0
Hardware: PC Windows
: High critical
Assignee: CHAN Tsz Yin
URL:
Depends on:
Blocks:
 
Reported: 2020-12-03 10:46 HKT by yuctam4-c
Modified: 2020-12-03 10:50 HKT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yuctam4-c 2020-12-03 10:46:23 HKT
As the principal of the game, the first player in the first turn in first round is not allowed to skip the turn. The related Code show below:

    public void skip() {
        if (skipCount < 4) {
            addHistory(currentPlayer.getName(), null);
            handleSkipPlay();
            currentPlayerIndex = nextPlayerIndex();
            skipCount++;
            turn++;
        } else {
            System.out.print("Your cannot skip! Please choose again!\n");
            pause();
        }
        incrementRound();
    }
Comment 2 yuctam4-c 2020-12-03 10:50:42 HKT
Bug Solved by adding new checking function isFirstPlayer():

 public void skip() {
        if (skipCount < 4 && !isFirstPlayer) {
            addHistory(currentPlayer.getName(), null);
            handleSkipPlay();
            currentPlayerIndex = nextPlayerIndex();
            skipCount++;
            turn++;
        } else {
            System.out.print("Your cannot skip! Please choose again!\n");
            pause();
        }
        incrementRound();
    }