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).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education