-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbattle_part03.py
More file actions
82 lines (57 loc) · 2.1 KB
/
battle_part03.py
File metadata and controls
82 lines (57 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PyPet Battle Game:
[ ] Two fighters are randomly chosen from a list of PETS, each starting with a
health of 100
[ ] Print out details about the chosen fighters
[ ] Each fighter takes a turn attacking the other until one fighter wins.
- Each attack will have a description and do randomly selected amount of
damage between 10-30
- Each attack will print out the description of the attack, the damage it
did, and the health of each fighter at the end of the turn
- Whoever reaches 0 first loses and the other player wins.
[ ] At the end of the game, announce the winner
"""
# The convention is to name modules (Python files) using
# lower_case_with_underscore
#
# The code for a project should be in a directory named using lowernounderscore
# for example:
#
# myproject/
# my_module.py
# my_script.py
# ### Imports ################################################################
from pets import PICS, PETS
# ## Global Variables ########################################################
# ## Functions ###############################################################
# ### top-level game functions ###
#
def lotto():
"""Return two randomly chosen PETs"""
return []
def intro(fighters):
"""Takes a list of two PETs (fighters) and prints their details"""
def fight(fighters):
"""Repeat rounds of the fight until one wins then
Take a list of two PETs and return the winning PET"""
return {}
def endgame(winner):
"""Takes a PET (winner) and announce that they won the fight"""
# The main() function should be at the last function defined
#
def main():
"""PyPet Battle Game"""
print("Welcome to the THUNDERDOME!")
fighters = lotto()
intro(fighters)
winner = fight(fighters)
endgame(winner)
# ## Runner ##################################################################
# This calls the main() function if the script is being run directly
# but not if it is being imported as a module
# This should always be at the very end of the script
#
if __name__ == "__main__":
main()