Goals for this assignment are to learn about:
Chapter 5 and 6
Create a "lists" package and add the ArrayStack, ArrayQueue, and ArrayList classes that are given in the text. Note, you also need to include the associated interfaces (Stack.java, Queue.java, and List.java), the iterator class (ArrayIterator.java) and the exception class (EmptyStructureException.java). To get started, here are the Stack.java, ArrayStack.java, and Queue.java files. Test all of your classes before continuing.
Carefully review the setup and rules of Yukon Solitaire. Get a real deck of cards and try playing the game several times (chance of winning is 1 in 4). Think about the types of list structures that would be best for each of the different components of the game. To do this, think about all operations you will need to perform on each part (adding cards, removing cards, printing out the cards, etc). Write down a simple UML diagram for your game before you begin to program.
Implement the game interface using a text based interface (e.g. a JTextArea). You will need to carefully plan out the other components of the user interface. For example:
Notes on the interface:
The above picture displays the "debug" mode. In the normal game, the cards in piles 0-6 to the left of the "....... :" would not be displayed.
The suit icons (♠,♥,♦,&clubs) are available through unicode and not ascii. To generate these icons, you need to change the body of the toString in the card class to be
return ""+ "-A23456789TJQK".charAt(rank) + "\u2660\u2665\u2666\u2663".charAt(suit);
These icons should display without a problem in a JTextArea but System.out.print() will not display these icons because (I think??) it only allows ascii.
If you discover otherwise, please let me know!
If you desperately want to create a GUI with card images then the instructor can provide images of all of the cards. However, this will add a lot of extra work so do not do this until you are certain you can complete the lab on time.
You will need a debug mode so that you can see what is happening with the cards that are face down.
Make use of iterators if you are using the list class.
On Monday Oct 8 in class, we will go over your UML design. Be sure to bring these to class. They will not be collected.
By midnight on Thursday Oct 11, zip together the entire project (containing the card, lists, and game packages) and email the code as an attachment to gorr@willamette.edu. Make sure a working jar file is included. Place CS241 Lab 5 in the subject line.
By Tuesday Oct 16 you should have demonstrated your code to the instructor.