Swiggy Round 1 coding test
-
Download and install an IDE such as
Eclipse
orIntelliJ IDEA
. -
Clone or download the project from the source repository.
-
Open the IDE and import the project into the workspace.
-
Resolve any project dependencies and ensure that the JDK is installed and configured.
-
Open the main class, which is likely to be called
Main
. -
Right-click on the main class and select
"Run as" > "Java Application"
from the context menu. -
The application should start running, and you can interact with it from the console or user interface, depending on how the application is designed.
https://github.com/abhishek-0713/swiggy-assignment.git
Enter number of players: 2
Enter name of player 1: Abhi
Enter name of player 2: Subhi
Top card: 4 of Spades
Abhi's turn:
Your hand:
3: 7 of Spades
4: 6 of Spades
Enter the index of the card you want to play:
4
Abhi played 6 of Spades
Top card: 6 of Spades
Subhi's turn:
Your hand:
0: 6 of Hearts
1: 3 of Spades
3: Ace of Spades
Enter the index of the card you want to play:
1
Subhi played 3 of Spades
Top card: 3 of Spades
Abhi's turn:
Your hand:
0: 3 of Hearts
2: 3 of Diamonds
3: 7 of Spades
Enter the index of the card you want to play:
3
Abhi played 7 of Spades
Top card: 7 of Spades
Subhi's turn:
Your hand:
2: Ace of Spades
Enter the index of the card you want to play:
2
Subhi played Ace of Spades
Reverse direction
Top card: Ace of Spades
Subhi's turn:
Subhi has no valid moves.
Top card: Ace of Spades
Subhi's turn:
Subhi has no valid moves.
Top card: Ace of Spades
Subhi's turn:
Your hand:
4: King of Spades
Enter the index of the card you want to play:
4
Subhi played King of Spades
Top card: King of Spades
Abhi's turn:
Your hand:
1: King of Diamonds
Enter the index of the card you want to play:
1
Abhi played King of Diamonds
Top card: King of Diamonds
Subhi's turn:
Your hand:
3: 6 of Diamonds
Enter the index of the card you want to play:
3
Subhi played 6 of Diamonds
Top card: 6 of Diamonds
Abhi's turn:
Your hand:
1: 3 of Diamonds
Enter the index of the card you want to play:
1
Abhi played 3 of Diamonds
Top card: 3 of Diamonds
Subhi's turn:
Subhi has no valid moves.
Top card: 3 of Diamonds
Subhi's turn:
Your hand:
3: Ace of Diamonds
Enter the index of the card you want to play:
3
Subhi played Ace of Diamonds
Reverse direction
Top card: Ace of Diamonds
Subhi's turn:
Subhi has no valid moves.
Top card: Ace of Diamonds
Subhi's turn:
Your hand:
3: Ace of Hearts
Enter the index of the card you want to play:
3
Subhi played Ace of Hearts
Reverse direction
Top card: Ace of Hearts
Subhi's turn:
Your hand:
0: 6 of Hearts
1: 5 of Hearts
Enter the index of the card you want to play:
1
Subhi played 5 of Hearts
Top card: 5 of Hearts
Abhi's turn:
Your hand:
0: 3 of Hearts
Enter the index of the card you want to play:
0
Abhi played 3 of Hearts
Abhi wins!
Congratulations, Abhi has won!