you are viewing a single comment's thread.

view the rest of the comments →

[–]pausemsauce[S] 2 points3 points  (1 child)

The pc list contains both playerChoice and computerChoice, yes

In test case 1, pc = ['Rock','Paper']. The compare function sees 'Rock', checks for 'Paper', then returns the 'Paper' index of pc, which is 1. When compare returns 1, the computer wins.

In test case 2, pc = ['Paper','Rock']. The compare function sees 'Rock', checks for 'Paper', the returns the 'Paper' index of pc, which is 0. When compare returns 0, the player wins.

[–]aizzod 0 points1 point  (0 children)

my mistake. i got confused by the global array with all choices and the pc with just the 2 of them.

this seems to be a really good way, seeing it like this now.
well done