Final Project for CS121, Java and OOP Principles.
This is one of the most ambitious projects I have ever done so far, and spent just over a week on it. Overall, I am pleased with it. I believe the I underestimated the scope of recreating Caravan, but I regret nothing and had a blast solving all the challenges.
I was able to replicate most of the rules and squash as many bugs as possible in the time I had. I learned a lot and would approach this project differently if I were to do it again.
Note: A few rules differ from the official Caravan rules. See "Note on rules/Known bugs" section below.
- Open project with your IDE, run main method in Main class
- Run in the console. If you don't know how, check out this freecodecamp.org article.
Note: You need to have the JRE installed for these methods.
This game was designed with two players in mind.
Once the game has begun, players will find themselves looking at this table:
Each player is competing to win at least 2 of the 3 caravan "routes" (A, B, or C).
Entering "O" on this screen shows us these options:
To begin, Player 1 must type "V" then choose a caravan route. This will bring up Player 1's "caravan" for that route.
All six caravans (two per route, i.e. one for each player) must be initialized with a number card in the first round.
Upon playing our first card, as Player 1, we can see that the card's value has been added to the table view. It is now Player 2's turn.
Entering "O" while viewing a caravan shows the above available options. "S" allows the player to play a card on their opponents caravan. This can only be done with face cards, and only after the first round is complete (all caravans have had a number card played).
Not so fast Player 1...
Those are the basics of command entering and general gameplay.
The rules can be pulled up in-game by typing "R" whenever the screen displays "ENTER 'O' FOR OPTIONS OR TYPE COMMAND".
As mentioned at the start of the README, there are a few things that differ from the official rules.
- Players start with a 52 card deck, therefore there are no jokers. There is no deck customization.
- There is no gambling. It isn't really necessary to play the game and would only add complexity.
- While multiple kings can be stacked, currently they do not continue to double the card they are attached to.