Skip to content

Commit 3cf5dd1

Browse files
committed
made changes to human, player and ai. need to finish human and then move onto game
1 parent 616de92 commit 3cf5dd1

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

aiplayer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44

55

66
class Aiplayer(Player):
7-
def __init__(self):
8-
super().__init__()
7+
def __init__(self,name):
8+
super().__init__(name)
9+
pass
910

1011

1112

1213

1314

1415
def choose_gesture(self):
1516
return random.choice(self.gestures)
17+
pass
1618

1719

1820

game.py

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11

22
from human import Human
33
from aiplayer import Aiplayer
4+
# from player import Player
45

56
class Game:
67
def __init__(self):
7-
self.human = Human()
8-
self.aiplayer = Aiplayer()
9-
10-
11-
8+
self.player_1 = Human("Buzz")
9+
self.player_2 = Aiplayer("Terminator")
10+
pass
1211

1312
def run_game(self):
1413
self.display_greeting()
1514
self.display_rules()
16-
self.choose_opponent()
17-
self.play_game()
18-
self.display_winner()
19-
15+
# self.choose_opponent()
16+
# self.play_game()
17+
# self.display_winner()
18+
pass
2019

2120
def display_greeting(self):
2221
print("Welcome to RPSLS!")
@@ -29,31 +28,19 @@ def choose_opponent(self):
2928
has_chosen = False
3029
while has_chosen is False:
3130
if self.opponent_choice == 'Y':
32-
print(f'you have chosen {self.player_one}')
31+
self.player_2 = Aiplayer()
32+
print ('You have chosen single player')
3333
break
3434
elif self.opponent_choice == 'N':
35-
print('you have chosen multiplayer')
35+
self.player_1 = Human()
36+
print('You have chosen multi player')
3637
break
3738
else:
38-
print('please Enter Y or N')
39-
break
40-
41-
42-
43-
def create_player_one(self):
44-
player_one = Human()
45-
player_two = Human()
46-
47-
48-
def create_player_two(self):
49-
player_two = Aiplayer()
50-
51-
52-
53-
54-
39+
self.opponent_choice = input('Will you be playing against the computer? Y or N: ')
40+
has_chosen = False
5541

5642
def play_game(self):
43+
#while both player scores are less than 3
5744
pass
5845

5946

human.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
from player import Player
22

33
class Human(Player):
4-
def __init__(self):
5-
super().__init__()
4+
def __init__(self, name):
5+
super().__init__(name)
6+
pass
67

78

89

910

1011

1112
def choose_gesture(self):
12-
user_input = input(f'please choose one of the following {self.gestures}')
13+
user_input = input(f'please choose one of the following {self.gestures}: ')
14+
if user_input == 'rock':
15+
16+
if user_input == 'paper':
17+
18+
if user_input == 'scissors':
19+
20+
if user_input == 'lizard':
21+
22+
if user_input == 'spock':
23+
24+
25+
26+
27+
self.player_1 chooses
1328
print(user_input)
29+
pass
1430

31+
# "copy and paste like 19 times"

main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from game import Game
2+
23
game = Game()
34
game.run_game()
45

player.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
class Player:
22

3-
def __init__(self):
4-
self.name = ''
3+
def __init__(self, name):
4+
self.name = name
55
self.gestures = ['rock', 'paper', 'scissors', 'lizard', 'spock']
6-
6+
self.score = 0
7+
self.gesture_choice = None
8+
pass
79

810

0 commit comments

Comments
 (0)