SWEN30006 Software Modelling and Design
Project 2: Whist
You and your team of independent Software Contractors have been hired by NERD Games Inc. to provide some
much-needed assistance in improving their innovative Whist card game. Your task is simple. You have to modify
the design and implementation to improve configurability, to add a new type of NPC, and to facilitate the addition
of other future changes. The details of the enhancements are as follow:
• Advanced NPC: As described in the background, the current version has only a random NPC who plays the
game by randomly selecting a card without regard for the rules. NERD Games Inc. wants a more intelligent
NPC to make the game more challenging. To select a card to play, NERD Games Inc. designed that the
advanced NPC will do 2 steps, i.e., cards filtering and card selecting. Figure 2 below provides an illustrative
approach of the advanced NPC. The card filtering step is optional and the card selecting step is
mandatory, meaning that the NPC can be configured to skip the card filtering step, but the NPC must
always use one of the card selecting approaches.
o Cards filtering approaches: The advanced NPC will first select a set of cards in the hand that can
be played. The NPC will use one of the following approaches to select a set of potential cards:
– Naïve legal approach: The advanced NPC will attempt to select the cards that
consistent with the rules, i.e., the cards in the lead suit and the cards in the trump
suit. If the NPC does not have cards in the lead suit nor in the trump suit, it will select
all cards in the hand (i.e., no filtering). If the NPC takes the lead, then no filtering.
– Trump saving approach: This approach is similar to the naive legal approach, but the
NPC will try to save the card in the trump suit. To do so, the NPC will attempt to select
the cards in the lead suit. If the NPC does not have the cards in the lead suit, then the
NPC will select the cards in the trump suit. Same as the naïve legal approach, if the
NPC does not have cards in the lead suit nor the trump suit, it will select all cards in
the hand (i.e., no filtering). If the NPC takes the lead, then no filtering.
o Card selecting approaches: The advanced NPC will select the card to play using one of the
– Random selection: The NPC will randomly select the card to play.
– Highest rank selection: The NPC will select the card with the highest rank to play. If
many cards are applicable for a selection, NERD Games Inc. is open to your idea on
how to select the card.
– Smart selection: The advanced NPC will record the relevant information (e.g.,
collecting the cards that been already played) and makes a reasonable selection. For
example, the NPC may consider the chance whether it will win or not. If not, it will
violate the rules by selecting card with the lowest rank. For this approach, NERD
Games Inc. is open to your ideas for the smart selection approach. However, NERD
Games Inc. does not expect a sophisticated algorithm. At least, this approach should
make a decision based on the collected information and it should look smarter than
the combination of pre-defined approaches above.
• Configurability: Currently all elements of Whist are set in the code. The system should be made more
configurable through a property file. You will have to make a judgement as to which parameters are worth
making configurable. Your system will read the property file named “whist.properties”. In your
deliverables, you must provide the following three property files to demonstrate your system with the
specified variations. The system should support repeatable runs (subject to interactive player choice) with
a fixed random seed of “30006”. All the properties make the card face up (like Figure 1).
Figure 2: an illustrative example of how the advanced NPC select a card to play.
Cards in NPC’s hand Potential cards Card to play
o whist.properties: one interactive player (Player 0) and three random NPCs, and game
settings as per the original system.
– Each player has 6 cards instead of 13 (nbStartCards = 6)
– The game ends when the player receive a score of 6 (winningScore = 6)
– Three players are advanced NPCs with the following configs:
a) Player 0 uses the naïve legal approach + random selection.
b) Player 1 uses the trump saving approach + highest rank selection.
c) Player 2 uses the highest rank selection (not using a filtering approach).
o smart.properties: Game setting as per the original system. Four players are as follow:
a) Player 0 is an interactive player
b) Player 1 is an NPC using the smart selection (not using a filtering approach).
c) Player 2 and 3 are random NPCs.
Remember that there might be more features in the future. Hence, you should apply your software engineering
and design knowledge to make the system extensible and facilitate the addition of other future changes.
Note: Despite the graphics in Figure 1, the advanced NPC (especially for the smart selection) must not violate the
principle of the game by using information that would not be visible to the NPC. For example, an NPC must not be
able to see the cards in another players’ hand.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx