0% found this document useful (0 votes)
3 views15 pages

Program Base

This document outlines the initial stages of developing GameBase.com, detailing the setup of an IDLE shell, importing necessary libraries, and defining lists of games categorized by genre. It explains the creation of functions and conditional statements to execute game selections based on user input. Finally, it discusses combining all components into a cohesive code structure for the graphical user interface (GUI).

Uploaded by

adi.sahib.1605
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views15 pages

Program Base

This document outlines the initial stages of developing GameBase.com, detailing the setup of an IDLE shell, importing necessary libraries, and defining lists of games categorized by genre. It explains the creation of functions and conditional statements to execute game selections based on user input. Finally, it discusses combining all components into a cohesive code structure for the graphical user interface (GUI).

Uploaded by

adi.sahib.1605
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Index

Section Name of section Pg no.

1 Briefing 2

2 How to start an IDLE shell 2-3

3 Importing all the necessary libraries 3-4

4 Defining the lists 3-8

5 Defining the function 8-9

6 Adding conditional statements 10-14

7 Combining the blocks 14-15


1. Briefing:

• In this document, we will cover the initial stages of [Link].


• This document will consist of the defined lists, functions and subsequent
conditional statements
• All these works will have simultaneous screenshots of the code
implemented in IDLE 3.12.7.

2. How to start IDLE shell:

• IDLE stands for Integrated Development and Learning platform. It is


default python language-based IDE. It is a very user-friendly development
platform.
• The program starts by making a new file in IDLE shell. We use a new file
to make the program and the execution of it will happen in the IDLE shell.
• We use IDLE as it is a very lightweight IDE and it is very versatile and makes
writing code easier and the code is very readable.
• The latest version of IDLE is downloaded. For this program, we are using
IDLE shell 3.12.7 version of IDLE.
• The new file is opened from the file drop down menu.

• All the output of this file is executed on the shell of IDLE

3. Importing all the necessary libraries

• To code this program, we will import Tkinter library. The Tkinter library is
used to implement graphical user interface in IDLE.
• Tkinter is a built-in standard library of the IDLE shell which provides us
with all the necessary graphical user options for our program.
• Tkinter library is imported into python as tk. This is done so that every
single callback made to tkinter library is done in the form of tk.
• In the code we will refer to the library tkinter as tk.
• Tkinter gives us all the functions and arguments we need for making the
button base of our program
• This library also has labels, text boxes, menus etc. but for our program we
need to use the button function of the tkinter library.
• This library is called at the start.
• The syntax to import the libraries is:

import library as lib

where library is the predefined name of the library and lib is the method
function we use to denote the library being called in the program.
4. Defining the Lists

• The concept of the program is that there are going to be lists that contain
the games of all the specific genres that we will provide the user.
• To do this, we will need to define those specific lists for each and every
genre we need.
• The genres that we will provide the user are as follows:

i. Action:
For all the games that contain the contents of fight and versus
based gameplay.

ii. Adventure:
For all the games that contain the contents of exploration and
open-world gameplay.

iii. RPG (Role-playing games):


For all the games that contain the contents that make the user
play a specific role or character in the gameplay.

iv. Simulation:
For all the games that contain the contents of real-life based
simulation gameplay.

v. Sports:
For all the games that contain the contents of sport-based
gameplay.

vi. Strategy:
For all the games that contain the contents of strategical
gameplay analysis and execution.

vii. Puzzle:
For all the games that contain the contents of puzzle solving
gameplay.
viii. Horror:
For all the games that contain the contents of jump scares and
ghost-based gameplay.

• The games we are going to add are:

i. Action:
Red Dead Redemption II, GTA 5, COD: Warzone, God of War:
Ragnarök, Spiderman 2, PUBG, Elden Ring, Sekiro: Shadows Die
Twice.

ii. Adventure:
The Last of Us II, Life is Strange, God of War: Ragnarök, Spiderman
2, Assassin’s Creed II, Elden Ring, Batman: Arkham City, Resident
Evil Village.

iii. RPG:
The Witcher 3: Wild Hunt, GTA 5, Elden Ring, Bloodborne, Sekiro:
Shadows Die Twice, God of War: Ragnarök, Dark Souls, Mass
Effect.

iv. Simulation:
The Sims 4, Cities: Skylines, Microsoft Flight Simulator, Euro Truck
Simulator 2, Elite Dangerous, Stardew Valley, [Link],
Subnautica.

v. Sports:
NBA 2K25, Madden NFL 25, EA Sports FC 25, WWE 2K25, Rocket
League, Golf with Your Friends, Top Spin 2K25, Super Mega
Baseball 3.

vi. Strategy:
GTA 5, Life is Strange, Assassin’s Creed II, Total War: Warhammer
3, DOTA 2, Civilization VI, Age of Empires II, StarCraft.
vii. Puzzle:
Sekiro: Shadows Die Twice, God of War: Ragnarök, Spiderman 2,
Assassin’s Creed II, Tetris Effect: Connected, Portal 2, LIMBO,
Mahjong.

viii. Horror:
Alien: Isolation, Silent Hill 2, Outlast, Phasmophobia, Five Nights at
Freddy's, Resident Evil Village, Little Nightmares, Amnesia: The
Dark Descent.

• Now all these games are entered into specific lists that are names
according to their specific genre.

• As we can see, a list named “list_action”, that is list name we used for
action, contains all the games we added for action-based gameplay.
• A list is defined by square brackets and the strings are separated by
double quotes.

• Syntax of list is:

list_name = [contents of the list separated by commas]


where list_name is the name of the list you can choose, while the
contents of the list need to be separated by commas.

• Similarly, all the lists are made.

• Lists are made my separating the strings by commas. Lists are mutable
data types and store homogenous data in them.
• Every genre is added to its abbreviated list name.
• This way they can be called when we use the if function for it.
• All the subsequent lists are made. These are used for the if commands
that will be defined in the function of button execution.

5. Defining the function

• After the lists are defined, we are going to define the function in which
all the if commands are used.
• To define the function, we use the def command.

• In the def command, button_click is the function name, while genre is


the parameter of the function.
• Syntax of the def function is:

def name_of_function(parameter):
……………………………..

• The name_if_function is the name of the function you choose.


• It is used to call the function; hence it has to obey the python naming
conventions and should be descriptive enough for us to know when to
call it.
• The parameter are arguments which are optional that the function can
accept as an input. This parameter will be used to implement the if
function in our code.
• Now we add the if functions to the code.

6. Adding Conditional statements

• The function needs conditions in which the lists we made need to be


executed.

• If statement is added to the function, and it uses the parameter to


compare.
• Syntax of the if statement is:

if condition:
……………statement………….
• The if statement here compares the parameter added to the function
name, to a button name we will define later.
• == is used to make a comparison. == is a comparing argument given
which only compares the data types on each end.
• This makes the if condition of the block getting executed open.
• Now in this if statement, we need to add our list of action-based games.

• Syntax of the print statement is:

print (statement needed to be printed)

• In the print statement, we used two more parameters, * and sep


• Both these parameters are used for clearer output.
• * is used as an unpacking argument, where it unpacks all the elements in
a list or tuple into individual arguments. This way we get a clearer output
of the different elements.
• sep is used to give a separation between the different printed elements
of the list.
• We can use any separation, such as sep= ‘,’ or sep= ‘+’, but to make the
program look better we use sep= ‘\n’. \n is newline argument, so every
element is printed in a newline.
• In the print statement here, we used the list we had defined for the
action-based games, and we printed it out if the function parameter was
data type was found to be “Action”.
• This “Action” will later be made into a button so when the button is
clicked, the if statement gets executed.
• Now similarly we have to make conditional statements for every button
genre we have.

• To continue the if statements, we use the elif command.


• Syntax of the elif command is:

elif condition:
……..statement…………

• The elif command is an else if command, which is an extension to the if


block we started.
• Elif commands get executed if the if statement is false.
• To make our program, we added all the other statements into consecutive
elif statements
• Elif statements are used to complete the entire block of all the button
clicks we want to program to be able to execute.
• This is the entire statement block completed for all the entered lists we
had from our previous sections.
• Now whenever this function is called, the program will compare the
clicked button’s parameter and compare it to each and every if and elif
statement.
• For the statement found true, the subsequent if-elif block will be
executed.
• We have now defined all the conditional statements we needed.
• Now we write the else command.
• The else statement is used to finish the if block
• Syntax of the else statement is:

else:
…….statement………..

• Else statement gets executed id none of the if and elif commands


execute.

7. Combining the blocks

• Now the blocks made in section 2, 3, 4, 5 are combined into a single


code structure.
• This will make us see what we actually wrote in the whole.

• We see that we have created all the lists containing all the elements of
the genres.
• We have also defined the function containing the if-elif-else functions
which give us the conditional execution of all the lists made
• Furthermore, now we need to define the buttons e need for the GUI
interface to execute the conditional statements we have defined in
button_click function.

You might also like