From abca9dbd4ff27c1e9ded5deefeabc35ca24fcdf5 Mon Sep 17 00:00:00 2001 From: jwberent Date: Wed, 3 Dec 2025 21:32:04 -0500 Subject: [PATCH] This is my third commit. I made the cars 2 in length although I am having a problem where they break apart sometimes. I am getting very close to finishing the project. I was having a problem where I made the symbol for the cars 'OO' and only one of the 'O' was leaving the screen when it made it to the far right of the screen. I emailed you and you said to only make the symbol 'O' and spawn 2 right next to each other. I figured out how to do this by myself but am now trying to figure out why they are breaking apart. --- __pycache__/path.cpython-312.pyc | Bin 1339 -> 1311 bytes __pycache__/person.cpython-312.pyc | Bin 1422 -> 1422 bytes __pycache__/spawner.cpython-312.pyc | Bin 1163 -> 1269 bytes new.py | 2 +- path.py | 4 ++-- spawner.py | 12 ++++++++++-- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/__pycache__/path.cpython-312.pyc b/__pycache__/path.cpython-312.pyc index 65eae9350c0d0d1c5223f40aa375633a4af8f745..80b629dfa4c4fc2fa3a88b9798ba9e16d2cb1f5f 100644 GIT binary patch delta 266 zcmdnZHJ^+3G%qg~0}%KH>Su18$Xm+DII-m#W8UOwM%&3t7*!dWCZA$-{XJ(vu%C&tjCBT+3q1C_8yKi<*^igXbp}MpnhoS~9GL oMIav)fvoe>WCYViN+1!iFb9zJi^C>2KczG$)vic+vNWp#0HKFLO#lD@ delta 260 zcmbQwwVR9gG%qg~0}x!W)XLm2k++nI$$w(=HO8vRQH-`+DNI#t3=ApE*&36lGO9DO zOy0}r%Fnu*5u|~Ep_aXdHHBreAd@yw#+FHzo2`PWf=Lo60~AeVQf6lZvzaINGuiU7 z`@Lia%DiL(5e$u3I8n#i}En-$1o2I9|hj1w=k*87xjg5*IUg}H_~g{cat zel-(Bq?VbRp;(R+wH!280SegaQVJ8n(%c z7{kR_fMP`;XWrsWOi77POi#@#(PW>@&m<$tSb2*jIkCtXOqvw40~IMKOg3T4XKa|f zgvrY73m=1^#0u|gyEC%EoPAHpf-Qfb^C{8GyY}Mg%gGZp>uhVaa z$rT<2IQuG(!UyrmY|I&q;*;~4RprHjHWZ5hi3Wx{{9+RdXQ*7}mtUZLkze-$hi;MN z-3vpe3eK31N-Cx<_t#B$v2r*8TlvwXO?9YpDfE_Vl4);4dj@W3`OD~wkU{T zhY=um6bk~07KR&q!VT`9SlCzJ^Dk?qSiCk_D-RYy8DwlbfGXnv-f*q%iqB QizF`(quwV5AOTha0NDXZ&;S4c diff --git a/new.py b/new.py index 49ca655..eee5196 100644 --- a/new.py +++ b/new.py @@ -3,7 +3,7 @@ from person import Person from spawner import CarSpawner from path import Car -board_size = (25, 25) +board_size = (30, 35) person = Person(board_size) spawner = CarSpawner() game = Game([person,spawner], {"score": 0,"lives":3}, board_size=board_size,color="black_on_white") diff --git a/path.py b/path.py index de0da70..e934da3 100644 --- a/path.py +++ b/path.py @@ -1,5 +1,5 @@ class Car: - character = 'OO' + character = 'O' def __init__(self, position): self.position = position @@ -25,7 +25,7 @@ class Car: def play_turn(self, game): lives = 3 width, height = game.board_size - if game.turn_number % 2 == 0: + if game.turn_number: #% 3 == 0: x, y = self.position if x == width - 1: game.remove_agent(self) diff --git a/spawner.py b/spawner.py index 0160ce7..ba86c35 100644 --- a/spawner.py +++ b/spawner.py @@ -9,8 +9,16 @@ class CarSpawner: game.state['score'] += 1 if self.should_spawn_car(game.turn_number): #car = Car((randint(0, width - 1), 0)) - car = Car((0, randint(0, height - 1))) - game.add_agent(car) + + #car = Car((0, randint(0, height - 1))) + #car2 = Car((30,randint(0, height - 1))) + #game.add_agent(car) + #game.add_agent(car2) + y = randint(0, height - 1) + car3 = Car((0, y)) + car4 = Car((1,y)) + game.add_agent(car3) + game.add_agent(car4) def should_spawn_car(self, turn_number): return randint(0, 1000) < turn_number \ No newline at end of file