The purpose of this exercise is to allow the student to demonstrate their understanding of application development, the creation and use of classes and objects in Python, and using the other tools (selection, iterations, functions, etc.) we have learned this term. We will make a simple game called 'Stray Cat Strut' - Using the grid class discussed in Chapter 9, create a 20 x 20 cell game board - This game board represents a backyard - Create a class called animal with two attributes: -- an attribute called 'location' which is a grid coordinate (e.g., B3) -- an attribute called 'lives' which is an integer. - The animal class has the standard methods (init, str, etc.) plus one additional method: -- a method called 'move' that changes the animal's location one cell up (N), one cell right (E), one cell down (S), or one cell left (W).

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 7E
icon
Related questions
Question

The purpose of this exercise is to allow the student to demonstrate their understanding of application development, the creation and use of classes and objects in Python, and using the other tools (selection, iterations, functions, etc.) we have learned this term. We will make a simple game called 'Stray Cat Strut'


- Using the grid class discussed in Chapter 9, create a 20 x 20 cell game board
- This game board represents a backyard
- Create a class called animal with two attributes:
-- an attribute called 'location' which is a grid coordinate (e.g., B3)
-- an attribute called 'lives' which is an integer.
- The animal class has the standard methods (init, str, etc.) plus one additional method:
-- a method called 'move' that changes the animal's location one cell up (N), one cell right (E), one cell down (S), or one cell left (W). 
- Extend the animal class to a subclass called cat, and another subclass called dog
- cat inherits the animal attributes and methods, but also has the following attributes and methods:
-- an attribute called 'attitude' which can have values of 'calm', 'strut' or 'panic'
-- an attribute called 'response' which can have values of 'meow', 'hiss', or 'claw'
-- a method called 'loseLife' which decreases the animal attribute 'lives' by one 
- dog inherits the animal class attributes and methods, but also has the following attributes:
-- an attribute called 'demeanor' which can have values of 'happy' or 'angry'
-- an attribute called 'action' which can have values of 'sleeping', 'walking', 'barking', 'growling', or 'attacking'
-- a method called 'makePuppies' which resets the current dog to the default state at a random location on the game board and creates another dog object at a random position on the game board with the default state
- Create a tree object that can have a grid position (use an asterisk character to represent a tree.)
-- The number of trees = two per level with random positions on the game board. Tree do not move within the level.
- Create a catNip object that can have a grid position (use 'N' to represent the catNip on the game board)
-- One catNip object per level at a random position on the game board
- Create a player object that can have a name and score
- Create a games object that has a list of names and scores

  • Welcome the player
  • Display  the top five players and their scores
  • Ask if the player needs instructions
  • Display the game board with the positions of the tokens (e.g., C for cat, 0 for dog 1, 1 for dog 2, N for catNip, asterisk for trees)
  • Get the players move (N, E, S, W, M, H, C, S, X)
  • Be able to save the game with the players name as the data file name
  • Be able to load saved games
  • You can play with the interaction between the cat and dog (what does barking cause the cat to do?) but here are some rough game rules:
  • Game rules:
    - Objective: The player makes points by moving the cat toward the catNip, and getting the catNip while avoiding any dogs.
    - Game Board Setup:
    -- Place trees (2 X Level) at random grid positions. Dogs and Cats cannot go through trees.
    -- Place catNip. catNip cannot be in the same grid position as a tree.
    -- Place dogs (initially the number of dogs is the same as the level) at random positions. Dogs cannot be in the same grid position as a tree or catNip. Dogs are numbered 0 through 9. The maximum number of dogs at any one time is 10.
    -- Place the cat in a random, empty grid position. The cat's initial attitude is calm and is indicated by depicting the cat with a capital 'C'.  

    - Actions:
    -- Player can move: N, E, S, W
    -- Player can Meow (M): Makes dogs go to sleep for two turns, cat goes from Panic to Calm.
    -- Player can Hiss (H): Makes dogs within one grid unit back off one space, token goes from 'C' for calm to 'P' for panic, can now claw.
    -- Player can Claw (C): Makes dogs within one grid reset at a random position, but creates another dog. The cat must have an attitude of panic to enable the claw action. 

Here is an example opening screen:

 

Stray Cat Strut
Please enter Player's Name: Jeff
Hello, Jeff. Welcome to Stray Cat Strut!
Player
High Scores:
BobCat
2200
TomCat
2100
Catepillar
FraidyCat
ScardyCat
2000
1900
1800
Do you need instructions Jeff? (y/n): n
Great, let's get started.
Player: Jeff Level: 1 Score: 3
1
Your move (N, S, E, W, H, C, S, X): I
Transcribed Image Text:Stray Cat Strut Please enter Player's Name: Jeff Hello, Jeff. Welcome to Stray Cat Strut! Player High Scores: BobCat 2200 TomCat 2100 Catepillar FraidyCat ScardyCat 2000 1900 1800 Do you need instructions Jeff? (y/n): n Great, let's get started. Player: Jeff Level: 1 Score: 3 1 Your move (N, S, E, W, H, C, S, X): I
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage