Bug 574 - The program will produce more than 2 players
Summary: The program will produce more than 2 players
Status: CONFIRMED
Alias: None
Product: CS3343 Chinese Checker
Classification: Unclassified
Component: Algorithm Component (show other bugs)
Version: unspecified
Hardware: All All
: --- minor
Assignee: yutongmen2-c
URL:
Depends on:
Blocks:
 
Reported: 2021-11-18 00:33 HKT by yutongmen2-c
Modified: 2021-11-18 00:35 HKT (History)
1 user (show)

See Also:


Attachments
The image indicates that more than 2 players are counted by the program. (36.79 KB, image/jpeg)
2021-11-18 00:33 HKT, yutongmen2-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yutongmen2-c 2021-11-18 00:33:36 HKT
Created attachment 88 [details]
The image indicates that more than 2 players are counted by the program.

The image indicates that more than 2 players are counted by the program.

The program prompt the 3rd player to play the move in turn 3.

Steps to reproduce:
1. Start the game.
2. Input 0 3
3. Choose 0 4
4. Input 0 4
5. Choose 1 3

Actual outcome:
The program prints: "Player 3 is playing."

Expected outcome:
The program prints: "Player 1 is playing."
Comment 1 yutongmen2-c 2021-11-18 00:35:10 HKT
Wrong Implementation:

System.out.println("Player " + TurnCounter.getTurn() + " is playing.");

Correct implementation:

System.out.println("Player " + (2 - TurnCounter.getTurn()%2) + " is playing.");