Description: My old friend Becky taught me a form of patience (solitaire) that I would like to be able to play on the computer. It is very simple, so really needs no graphics but, for fun, I will give you classes to do that as well.
This is how it works:
Here is an example (H is hearts etc. The new card dealt is in bold): See image.
Sometimes you can amalgamate piles in the middle:
3H 4D 7C 8S 3D becomes 3H 3D 7C 8S and then 3D 7C 8S (think about it)
Your game should have a menu that allows you to:
You should save a little file of low scores – the score is the number of piles left at the end of the game. When the person is finished playing you should give them the opportunity to submit their score to that file if appropriate.
MAKE SURE YOU DO THIS A BIT AT A TIME!!!! Test each class and function as you develop it – never get too far from a working application. The first 3 requirements should be working before you attempt to support the playing the basic game requirements. You may never get to the ‘amalgamate piles’, ‘play for me’ or ‘high score’ requirements. If you do a good job on the rest of it you will still do OK.
Your code should demonstrate use of ArrayLists, a do..while loop, catching exceptions, reading from and writing to a text file, checking errors (for instance illegal moves). It should have good Javadoc comments and appropriate algorithms.
I have provided a file with the ‘card’ information in it. Read it in to get a ‘pack’.