0% found this document useful (0 votes)
2 views4 pages

Programming Tasks

The document outlines five programming tasks related to the Breakthrough game, focusing on modifying methods to enhance gameplay features. Tasks include displaying the number of cards left in the deck, implementing error messages for duplicate card plays, adding a Mulligan option, introducing a Peek feature, and allowing players to quit with a final score. Each task requires source code changes and evidence through screen captures of tests performed.

Uploaded by

ryanseb007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Programming Tasks

The document outlines five programming tasks related to the Breakthrough game, focusing on modifying methods to enhance gameplay features. Tasks include displaying the number of cards left in the deck, implementing error messages for duplicate card plays, adding a Mulligan option, introducing a Peek feature, and allowing players to quit with a final score. Each task requires source code changes and evidence through screen captures of tests performed.

Uploaded by

ryanseb007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming Tasks

Task 1

This question refers to the PlayGame method of the Breakthrough class.

The number of cards left in the deck should be printed out after the current cards in
the player's hand each turn.

Test the changes you have made:

Run the game and play two turns, showing the number of cards in the deck.

Evidence that you need to provide:

• PROGRAM SOURCE CODE showing changes made to the PlayGame method.


• SCREEN CAPTURE(S) showing the required test.

Task 2

This question refers to the PlayCardToSequence method of the Breakthrough class.

Under the rules of the game, a player cannot play two cards of the same type in a
row. However, there is no error message warning the player when they attempt to do
this.

Modify the PlayCardToSequence method in the Breakthrough class to include an error


message which tells the user that they cannot play two cards of the same type
sequentially.

Use the GetCardDescription method to highlight to the user which card was just played
and explain that it is the same as the type just played.

Test the changes you have made:

Run the game and show at least one turn played where the error does not occur,
and one that shows the new error message under the correct conditions of playing a
duplicate card. This should show that:

1. The error message is displayed, and


2. The card is not played.
Evidence that you need to provide:

• PROGRAM SOURCE CODE showing changes made to the


PlayCardToSequence method
• SCREEN CAPTURE(S) showing the required test cases

Task 3

This question refers to the PlayGame and GetChoice methods and the creation of a new
attribute, MulliganUsed, of the Breakthrough class.

Each player gets 1 Mulligan per game where they can take all the cards in their discard pile and
the sequence, put them together as a single pile, shuffle it, then draw (when repopulating the
player's hand) from this pile until it is empty. The current lock, including any remaining cards, will
remain unchanged.

Create a new method in the Breakthrough class called MulliganUsed which will return True if
the Mulligan has been used. If MulliganUsed is False, then display an additional (M)ulligan
option. Once used, set MulliganUsed to True. If True, the Mulligan option is no longer
displayed or usable.

Test the changes you have made:

• Run the game


• Solve one challenge
• Use Mulligan
• Play one card
• Attempt to Mulligan again (should not be possible)

Evidence that you need to provide:

• PROGRAM SOURCE CODE showing changes made to PlayGame


• PROGRAM SOURCE CODE showing changes made to Breakthrough
• SCREEN CAPTURE(S) showing required test

Task 4

This question refers to the PlayGame and GetChoice methods of the Breakthrough class and
the creation of a new attribute (with accessor methods), PeekUsed in the Lock class.

Introduce a Peek option. This can be used once per lock, and allows a player to see the next
three upcoming cards. There should be a new command in PlayGame to allow the player to
choose this option while the ‘deck peek’ is still available.
Create a new attribute in the Lock class called PeekUsed. Create accessor methods to update
and retrieve the PeekUsed attribute (get/set).

Update the GetChoice() method in the Breakthrough class to give the user the peek option.
This menu option should only appear if the PeekUsed attribute is False.

Introduce an option to the menu in the PlayGame() method to accept ‘P’ as input for peek.
This menu option should only appear if the PeekUsed attribute is False.
Display the next three cards from the deck using the GetCardDescriptionAt() method.
Set the PeekUsed attribute to True after the peek option has been chosen by the user.

When the player is given a new lock, set the PeekUsed attribute appropriately so they can use
the peek option again.

Test the changes you have made:

Run the game and peek (peek is an option, it works), and then it’s no longer available.
Test to make sure it doesn’t work even though the option isn’t displayed.
Solve a lock and make sure peek is now an option again.

• PROGRAM SOURCE CODE showing changes made to the PlayGame method


• PROGRAM SOURCE CODE showing changes made to the GetChoice method
• PROGRAM SOURCE CODE for the new PeekUsed attribute
• SCREEN CAPTURE(S) showing the required test

Task 5

This question refers to the PlayGame and GetChoice methods of the Breakout game.

The player will have a new option in PlayGame to (Q)uit, and for this they will be given a score
for each card remaining in the deck. Print out their final score as they quit.

Note: The code should exit immediately without using any system.exit() statements,
although break/continue is allowed of course.

Test the code as follows:

• Play one turn of a game


• Choose quit
Evidence that you need to provide:

• PROGRAM SOURCE CODE showing changes made to the PlayGame


• PROGRAM SOURCE CODE showing changes made to the GetChoice
• SCREEN CAPTURE(S) showing the required test

You might also like