Build a console-based (i.e. runs in terminal) unix-compatible interactive card game. You can pick Blackjack, Solitaire, Memory, or any other game of your choosing (please include game rules in this case).
- It is a popular folk card game in China that has a unique card rule. The player wins or loses with three cards in the hand, and the player can compare with the other players at the time of his operation.
- The number of participants in the game is 2 people, using a pair of playing cards that have been removed Jokers, a total of 52 cards.
- Each of the 2 players gets the hand with 3 cards from the stack.
- (Not implemented)The game start with a base ante. Each player could pay for the ante first and could bet with chips, or just pay for the ante and surrender.
- According to the pattern of hand, player could choose to compare with the opponent or just surrender.
- Based on the comparing rules, it is to decide who win the game.
There are different types of hand with 3 cards, they are:
- Boomb: 3 cards has the same number. (eg. ♦A ♥A ♠A, ♠2 ♣2 ♦2)
- Golden Straight: 3 cards belong to the same suit and their number is a straight. (eg. ♣A ♣2 ♣3, ♠Q ♠K ♠A)
- Golden: 3 cards belong to the same suit. (eg. ♣A ♣10 ♣J, ♠2 ♠4 ♠8)
- Straight: The number of the three cards is a straight. (eg. ♣A ♠2 ♣3, ♥8 ♠9 ♦10)
- Pairs: 2 of 3 cards has the same number. (eg. ♣A ♠A ♣3, ♥K ♠2 ♦2)
- Single: Other patterns.
- Special Single: The pattern of numer 2 3 5, which is the smallest single pattern in the game. (eg. ♣2 ♠3 ♣5)
- Common rules: Single < Pairs < Straight < Golden < Golden Straight < Bomb
- Special rule: Bomb < Special Single
- Game could be tied
- The basic rule for single, Pairs, Golden and Bomb is:
2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < J < Q < K < A
- The basic rule for straight and Golden straight is:
A23 < 234 < 345 < 456 < ... < JQK < QKA
-
The special single could just like single unless the case of comparing with Bomb.
-
For Pairs, compare the number of pair first and then the single if the 2 players have the same number of pair pattern.
-
Regardless of the suit type, and tied game is allowed.
- JDK: jdk1.8.0_191
- JRE: jre1.8.0_201
cd ./IDEA_version
- Run the CardServer.
- Run 2 CardClient with 2 consoles.
- For each client, follow the game instructions and get the comparing result together with the hand pattern of the opponent.
cd ./Console_version
#Compile server
javac CardServer.java
#Compile client
javac CardClient.java
#Run server
java CardServer
#Run client 1
java CardClient
#Run CardClient 2
java CardClient
- Run the CardServer on console.
- Run 2 CardClient with 2 different consoles.
- For each client, follow the game instructions and get the comparing result together with the hand pattern of the opponent.
Here is a demo of first version Card Game:
- This game is a socket-base multi-player card game, which could be applied on a Server for playing online.
- The Server and Client are extensible by just change the class 'Gameground'. Card and Deck class are extensible as well.
- Include the bet mode for players.
- Extend it to more than 2 players.
- Add some abstract class and interface for more card games.
- Do some edition of input and output to make it beautiful and fix some bugs.