Python Forum
Rock paper scissors in python with "algorithm"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rock paper scissors in python with "algorithm"
#16
Please post entire error trace.

You get an error because computer_action is an integer, not a GameAction.
from enum import IntEnum

class GameAction(IntEnum):
    Piedra = 0
    Papel = 1
    Tijeras = 2
    Lagarto = 3
    Spock = 4

x = 1
y = GameAction(x)

print(x, y)
Output:
1 GameAction.Papel
x is an int, y is a GameAction. You need to convert the computed computer_action from int to a GameAction.
Agat0 likes this post
Reply


Messages In This Thread
RE: Rock paper scissors in python with "algorithm" - by deanhystad - Feb-28-2022, 12:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Algorithm for extracting comments from Python source code Pavel1982 7 3,014 Aug-28-2024, 02:50 AM
Last Post: timothyferriss
  Rock Paper Scissors Project in Python ankitdixit 8 7,087 Feb-23-2024, 03:14 PM
Last Post: DPaul
  Trying to create a visual rock paper scissors game urmom33 1 2,787 Dec-03-2022, 09:12 PM
Last Post: deanhystad
  Problem restricting user input in my rock paper scissors game ashergreen 6 6,518 Mar-25-2021, 03:54 AM
Last Post: deanhystad
  Odd behavior with Rock Paper Scissor game DustinKlent 2 2,650 Aug-27-2020, 03:55 PM
Last Post: DustinKlent
  Trying to implement Best of 3 logic in rock paper scissors game ShAhCh 5 5,131 May-11-2020, 04:31 PM
Last Post: ShAhCh
  Rock Paper Scissors with dictionaries ewgreht 2 5,104 May-01-2020, 03:19 PM
Last Post: deanhystad
  Rock, Paper, Scissors.. Help..hidden bug xxunknownxx 4 3,524 Mar-19-2020, 02:46 AM
Last Post: jefsummers
  POS receipt print cannot make paper cut using python AP_Development 1 3,909 Dec-12-2019, 08:48 AM
Last Post: buran
  Problem with Basic Rock Paper Scissors code BirinderSingh 3 3,730 Sep-13-2019, 03:28 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020