Skip to content

Instantly share code, notes, and snippets.

@Pharaoh00
Created December 13, 2018 01:54
Show Gist options
  • Save Pharaoh00/b5f5c229aaff18b2148ca92deb1c1f78 to your computer and use it in GitHub Desktop.
Save Pharaoh00/b5f5c229aaff18b2148ca92deb1c1f78 to your computer and use it in GitHub Desktop.
import random
moves = ["rock", "paper", "scissors"]
class Player:
self.move = "something"
self.move2 = "something"
def learn(self, my_move, their_move):
computer = random.choice(moves)
def randomPlayer(self):
choice = random.choice(moves)
def humanPlayer(self):
move = input("rock, paper, or scissors?")
if not in moves:
"DO SOMETHING"
one = Player()
two = Player() # You are refering the class Player()
def beats(one, two):
if one is tow:
return "tie"
if one is "rock":
return "{}".format(someVariable)
elif one is "paper":
return "{}".foramt(someVariable)
"CONTINUE THE CODE..."
class Game:
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
self.score1 = 0
self.score2 = 0
def play_roud(self):
move1 = player.humanPlayer("self") # whats is this?
move2 = player.randomPlayer('self')
print("Player 1: {} Player 2: {} beats {}, {}".format(variable1, variable2, varible3, variable4)) # You see the pattern?
beats('self', move1, move2) # Why you are refering "self" on a def call?
print(f"Score1: {score1},Score2: {score2}".format(score1, score2))
# You use format here? Why not on the others?
self.p1.learn(move1, move2) # does make sense this call
self.p2.learn(move2, move1)
if __name__ == '__main__':
game = Game(player.humanPlayer('self'), player.randomPlayer('self'))
# You keep calling "self". Self is not a arguments, at leas not how you
# are thinking.
game.play_game()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment