Search⌘ K
AI Features

Writing the Game Logic - Part 2

Explore how to implement the core logic of a Rock Paper Scissors game using Python's Tkinter library. Understand how to process user and computer choices, update scores, and display results in the GUI. This lesson guides you through writing conditional statements for game scenarios and integrating the logic into a functional desktop app.

Let’s define the result() method, which will implement the core logic of the game.

Accepting the input parameters

We will start by accepting the user choice and computer choice as parameters of the method.

Let’s also initialize the global variables which store the scores.

Python 3.8
def result(user,comp):
global USER_SCORE
global COMP_SCORE

Writing the core logic of the game

The core game logic is the ...