7.05 project.md rewrite. Use if you want to. #402
jdonwells
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found the project.md for the Unit 7 project hard to use. So I rewrote it. Presented here for comment or reuse. It should be noted that I added a fifth lesson to Unit 7 covering Double Dispatch. #390
Project 7: Pokemon
Overview
In this project, we will be creating a basic implementation of a Pokemon game. This project will use objects. The Pokemon classes, the Player classes, and the Attack class. We will be using a type of Double Dispatch instead of a game loop.
You will be given most of the game code. You will then need to finish it. Because most of the code is already done you should expect to read the code and figure out how it works more than type in new code. To understand the starter code you may need to make a model of it.
Game Play and Rules
Begining the Game
The Game
randint()
is a good way to do that.Pokemon Status report
The Pokemon status (p) report should look something like this:
Ending the Game
Computer Player
The computer player will select between three of the four commands available. Pokemon status (p) makes no sense for a computer player to choose. 2/3 of the time the computer player should attack. 1/6 of the time the computer should heal and 1/6 of the time the computer should switch pokemon.
You can implement the above probabilities by simply using
choice(['a', 'a', 'a', 'a', 'h', 's']
and treating that as a command choice. If the computer player decides to switch (s) do not allow the choice of a knocked-out Pokemon.Pokemon
There are 9 Pokemon. 3 Pokemon of each of the 3 types:
Grass Type:
Fire Type:
Water Type:
Pokemon Attacks
All Pokemon of the same type have the same set of attacks. Each attack has attributes name, attack power percentage, and accuracy percentage.
Grass Type
All grass types have the following attacks:
Fire Type
All fire types have the following attacks:
Water Type
All fire types have the following attacks:
Your assignment
You will receive some starter code. You will receive 370 lines of code. You will need to add about 70 lines of code to finish the game.
You will need to implement these things:
choice()
and/orrandint()
to make decisions.pocket_monsters
list of available Pokemon. These additional Pokemon are described in the Pokemon section above.make_a_move()
method of the Player class to call all 4 commands based on player choice. Both User and Computer should use this same method.If you don't get this far then try to copy and paste the entire starter code again.
Starter Code
Testing Your Computer Player
Because both User and Computer players have the same method names (Polymorphism). You can have two computer controlled players battle each other. You can do that easily by instantiating two Computer players and telling them to fight!
Look through the ouput and see if you find anything that looks wrong. Fix all the bugs you find then try to battle your computer player yourself.
Additional Things to Do
If you finish everything early you can make your computer player even smarter. Look for heuristics (expert level rule of thumb). Things like switching to a Pokemon that does extra damage to the player's chosen Pokemon. If the user has a Pokemon that is almost knocked out choose an attack that is more likely to hit. When choosing your 3 Pokemon, choose Pokemon that are strong against the user's 3 chosen Pokemon. There are many more. Add them and see how smart your computer player can get.
The code I expect them to create looks like this:
Beta Was this translation helpful? Give feedback.
All reactions