- Sorcery is a basic card game consisting of two players with decks consisting of minions, rituals, spells, and enchantments.
- The goal of the game is to bring the other player's health down by attacking him using the cards that you pull from you deck.
- Minions (the middle rows) can be played from your hand onto the field, where they can be used to attack other minions or the other player.
- Rituals (top-left and bottom-left) are special cards that have a special ability, inflicting an effect on the state of the game.
- The graveyard (top-right and bottom-right) holds the respective players' "dead" or used-up cards
-deck1 deckList1.deckand/or-deck2 deckList2.deckwill take custom decks-init tests.testwill read the filetests.testas stdin-testingflag will not shuffle the decks at the start of the game-graphicsenables the X11 graphical interface alongside the TextDisplay
help-- Display this message.end-- End the current player's turn.quit-- End the game.attack minion other-minion-- Orders minion to attack other-minion.attack minion-- Orders minion to attack opponent.play card [target-player target-card]-- Play card, optionally targeting target-card owned by target-player.use minion [target-player target-card]-- Use minion's special ability, optionally targeting target-card owned by target-player.inspect minion-- View a minion's card and all enchantments on that minion.hand-- Describe all cards in your hand.board-- Describe all cards on the board.
- To decrease coupling and increase cohesion, the game was implemented as three different components
- The view handled all displaying of information. Since the subject-observer pattern was used, the only thing the controller ever had to do was notify its observers.
- The model consisted of all the Cards (that is, minions, enchantments, players (!), etc.)
- The controller was the Board, which controlled the state of the game.
- Because certain cards were able to effectively change the state of the board (and therefore required access to the Board), the cards were given a static pointer to the Model of the Board. As a result, they were unable to access the implementation, but were still able to effect the state of the board.
- To facilitate the addition of two different views, namely the GraphicsDisplay (which uses X11 libraries) and the TextDisplay (which simply outputs to stdout), the subject-observer pattern was used.
- Each view was a concrete observer of the Board, which would notify the views of any relevant commands