Classic TicTacToe just in Executable format

First, pick either 'X' or 'O' from the screen then, play the normal one Player TicTacToe.
Playing on Terminal is kinda boring so, I made it into an executable file.
This commit is contained in:
Chander Jindal
2022-03-12 22:26:23 +05:30
committed by GitHub
parent fc9ea8eaf9
commit 40557ce86b
5 changed files with 348 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import os
import game_config as gc
from pygame import image, transform
def GetName(val):
return str(val) + ".png"
class Image:
def __init__(self, val):
self.name = GetName(val) #names of image with .png
self.image_path = os.path.join(gc.ASSET_DIR, self.name) #path of image from the assets file
self.image = image.load(self.image_path) #loaded the image
self.image = transform.scale(self.image, (gc.IMAGE_SIZE - 2 * gc.MARGIN, gc.IMAGE_SIZE - 2 * gc.MARGIN)) #fixed image as per req.
# self.box = self.image.copy() # box
#self.box.fill((200, 200, 200))
if __name__ == '__main__':
for i in gc.ASSET_FILES:
temp = Image(i)
print(temp.name,temp.image_path,temp.image,temp)