From 17b109e98eca6c7615f20d69c1eddfa5a4a9ac25 Mon Sep 17 00:00:00 2001 From: Lakota Dolce Date: Wed, 24 Dec 2025 12:18:15 -0500 Subject: [PATCH] Updated and reformatted README --- README.md | 33 +++++++++++++++++++-------- src/__pycache__/main.cpython-313.pyc | Bin 12767 -> 13171 bytes src/main.py | 21 +++++++++-------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 51a2a61..afc6915 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,12 @@ This is my attempt at building Conway's game of life in multiple languages. My first attempt is to do it in Python using Pygame and other libraries. I do plan on showcasing these on my website. -## Running with Python +## Setting up Python -To run the Python version I recommend that you set up a python virtual environment, you can do this with the following command +To run the Python version of this program, I recommend that you set up a python virtual environment. The current recommended Python version is Python 3.13 by Pygame. You can set up the virtual environment with the following command: + +`python3.13 -m venv /path/to/virtual/environment` -`python -m venv /path/to/virtual/environment` After that you can use it to run the program and pip installs to get the libraries. @@ -16,16 +17,30 @@ After that you can use it to run the program and pip installs to get the librari The following commands should install any dependencies and ensure you are ready to run the program. -`pip install --upgrade pip` - This will update pip to the version compatible with the virtual environment. +`pip install --upgrade pip` + - This will update pip to the version compatible with the virtual environment. -`pip install pygame pygame-menu pygbag numpy importlib` - This will install the dependencies needed for the project. +`pip install pygame pygame-menu numpy` + - This will install the dependencies needed for the project. ### Running the program -Running the program is fairly simple. +Running the program is fairly simple. Starting the program can be done with the following command: -Starting the program can be done with the following command: +`python -m src.main` -`python -m src.main` -Once running the menu is fairly simple and some parts do not work at the moment. However once in game the right mouse will remove a cell and a left click will create a cell. To start the simulation you press the return button, this will prevent you from making new cells. the same button will stop the simulation in place. To clear the screen and stop the simulation if running simply press C. Escape will pause the game but the simulation will not stop. To exit press escape and follow prompts to quit the game. +### Basic Controls + +Once running, the menu is fairly simple and some parts are still a work in progress. This can be navagated by using the Left mouse and clicking on the buttons on-screen to navigate. + +Once in the game: + +- Use Right mouse will remove a cell +- Use Left mouse will create a cell. +- Use Return/ Enter to start/stop the simulation + - NOTE: This will prevent you from making new cells while the simulation is running. +- Use C to clear the screen and stop the simulation. +- Use Escape to pause the game + - NOTE: The simulation will not stop. +- To exit press escape and follow prompts to quit the game. diff --git a/src/__pycache__/main.cpython-313.pyc b/src/__pycache__/main.cpython-313.pyc index 526545903b56c08273b262008148d9f9e5f89bd5..fce4dd41f12eda77924e86c908ebc549fab1f934 100644 GIT binary patch delta 1715 zcmb_cTTC2P7(QobmYv;U7TC)m%NB;)!fx4ek((_A5h!TrBD*D0#%8m^?6Pq$FtgNz z7^Lx`K4??@ZM5+cZ;5?qOq$gfV|+2853Q!8q-_?B#`J|m6GPQRAFSsL9iVOElP8;R z{`39c|NUoX&pAKN+=<)o2!aifA(oFN#hOd@Z?R>?f>5%D&Hs$wU~nM6Xnq;nyNN{G zPhbVz7M#FY2I}9(2%SSRE!IZ_2h9j&kj(5bCit@4=a@vD_b4YC?I#ippEgy2pL2;a zyQ5_$am3VNn#3{-n@wIQ=2hI)D(5 zB$PmYHl$KoH4*SL`a_4!UP^FkEqTCST>CUruqD*w?07t`DLJ)~)-(~&=n5rCQUjE! zGk{iW=LwK6R_1v-{Cd^OQ{M}Yvu$t2Z;HM((RW>Jx)8V_biRUbL)IFoG$VW0??uS& z+?F)1iH+Aq|Am7$gf2)~E8vQ?9CyPddu9F~>zD~|!CmWz@Jn$G^toKvY($Xu^6+PI zxz1V$+sSaU3+7AQ@R$(CR`@^=U-A!YGg43*$ts$Z%SyR9MIx`1OJ)+9)FNf)bIEK* zlhR6Naj9{T2nSP2OeIpPn^6@dBfT(}Oes<_qjQN^T3PBDQ{p)(on6!vQZX<)t4T3w zMoFc1I_y-29w_Y#ClhnKwP7WlJxNw}uRN}1)Bo8Tt_UyU^Dt`f=Csc8 zr$eVg*POlU?BV-}qw8$wJ|eQt9?P%TKQ`GnXUV_iH*N2L31}-T;Aiv2j$aw9!Qbv+ z(IibfV5KYw(_&fC6q%~WVL|lZ7`!UhnrZp-`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/src/main.py b/src/main.py index d98c721..8084e96 100644 --- a/src/main.py +++ b/src/main.py @@ -1,14 +1,13 @@ import sys import pygame -#import pygbag used for serving on a website would need to change the code import os import pygame_menu import numpy as np import math import random as rand -SCREEN_X = 1280 -SCREEN_Y = 720 +SCREEN_X = 1920 +SCREEN_Y = 1080 SCREEN = None MENU_X = 1 MENU_Y = 1 @@ -54,16 +53,17 @@ def updateGame(): pygame.display.flip() def drawRect(x,y, color): - global CELL_SIZE #Draw the rectangle square = pygame.Rect((x,y, CELL_SIZE, CELL_SIZE)) pygame.draw.rect(SCREEN, color, square) def drawGrid(): - # Draw the grid lines only - for x in range(0, SCREEN.get_width(), 100): + # Draw the grid lines + gridOffset = CELL_SIZE * 10 + for x in range(0, SCREEN.get_width(), gridOffset): + #(display,color, start, end) pygame.draw.line(SCREEN, (0, 0, 60), (x, 0), (x, SCREEN.get_height())) - for y in range(0, SCREEN.get_height(), 100): + for y in range(0, SCREEN.get_height(), gridOffset): pygame.draw.line(SCREEN, (0, 0, 60), (0, y), (SCREEN.get_width(), y)) def displayMenu(): @@ -79,7 +79,10 @@ def displayMenu(): def controlsMenu(): SCREEN.fill((0, 0, 0)) menu = pygame_menu.Menu('Controls', MENU_X, MENU_Y, theme=MENU_THEME) - menu.add.label('Controls coming soon') + menu.add.label('Esc - Goes to the settings / options menu') + menu.add.label('C - Clears the screen while in the game') + menu.add.label('Left mouse - Adds a cell to the screen while in the game') + menu.add.label('Right mouse - Removes a cell from the screen while in the game') menu.add.button('Back', settingsMenu) menu.mainloop(SCREEN) @@ -248,7 +251,7 @@ def main(): pygame.init() try: #initialize the screen and set the height and widths - SCREEN = pygame.display.set_mode((1920,1080), pygame.RESIZABLE | pygame.SCALED) + SCREEN = pygame.display.set_mode((SCREEN_X,SCREEN_Y), pygame.RESIZABLE | pygame.SCALED) SCREEN_X, SCREEN_Y = SCREEN.get_size() MENU_Y = .9 * SCREEN_Y