Continuous Assessment for ECM2414 - Software Development, set by Prof. Yulei Wu (Year 2, Semester 1). Uses multi-threading in Java to simulate the playing of a simple card game with numerous players and decks. Developed as a pair programming project.
This work received a final mark of 91/100.
Please see specification.pdf
for specification.
To compile the main program, do:
javac CardGame.java
To create a JAR file containing the main program, first recompile the program. Then, do:
jar -cfe cards.jar CardGame *
To run the main program, do:
java CardGame
Alternatively, to run from the JAR file, do:
java -jar cards.jar
You will be prompted to input the number of players and then be asked to provide the location of a pack file. Please note that only .txt
files are accepted, with all card denominations on a new line, with no whitespace or strings or any other symbols. If the executable tells you that there is a problem with your pack file, please check again and ensure that none of these illegal characters are appearing anywhere.
When referencing the pack file, you may use an absolute or relative filepath. Please note that in order to simply reference the file by name (e.g., simply using "pack.txt"), you must make sure that the pack file sits in the same directory as the .class
compiled files or the .jar
executable. If there are problems with this, please revert to using the absolute path of the desired pack file.
The tests are written using JUnit 4. junit.jar
and hamcrest-core.jar
are provided in the submission to run the tests.
To compile the tests, do:
javac --class-path ".;junit.jar" TestSuite.java
To run all the tests, do:
java -class-path ".;junit.jar;hamcrest-core.jar" org.junit.runner.JUnitCore TestSuite
TestSuite
is a class that runs all the tests.
When viewing the deck files after a game, it is possible that some decks may have more/less cards. This is normal and to be expected - due to the nature of the multithreaded environment, the game may suddenly end while certain decks have less cards than others.
Please note that the number of players is decided by the user and the pack should be provided by the user as well.
Developed by Talhaa Hussain and Reuben Kurian for the University of Exeter, module code ECM2414.