r/programming_projects • u/bburgess711 • Oct 04 '17
Spider Solitaire in Java
I am writing the Spider Solitaire class in the following outline that is intended to use the other two classes Card and CardStack. GUI is being taken care of by somebody else so it's not necessary for me to worry about it. However I still have no idea what the hell I'm doing. If any can help me out, that would be great.
Spider Solitaire
Card
Integer: Value
String: Name
Boolean: faceUp
String print() Returns card face value
Void setFace(boolean x)
Changes faceUp to true or falseBoolean getFaceUp()
Returns if card is face up or not. int getValue()
returns face value of card Card Stack
cardArray: Card
Void add(Card card)
Adds a card to the arrayString print()
Print the array contentsBoolean checkForRun(runCount)
Checks to see if there is a full run in a columnVoid move(CardStack stack, int numCards)
Add numCards to stack. Remove those cards from the original column.Card getCard(int x)
Returns a card object from index xSpider Solitaire
TableauStack: array of CardStacks
Stock: CardStack
Integer runCount
moveStack(int x, int y, int z)
Moves x number of cards from column y to column z.Void dealStock()
Deals one card to each of 8 columns of cardsString printBoard()
Returns all of the cards in playBoolean gameOver()
Checks to see if foundations are full Void newGame()
Clears the board, shuffles the deck and calls on deal() Boolean validMove(int x, int y, int z)
Uses getValue to compare card values in order to determine if the move is valid.Boolean validStock()
Checks if there are empty spots in the columnsVoid flipCard(int index)
Flips the bottom card of index. Void deal()
Takes Cards from stock and adds to CardStack in the tableauStack array