campfire4.py Paradise Destroyed by Brett Stalbaum and Llama3.2 - this required a lot of debugging
comments in campfire2.py and campfire3.py will provide context
Would you rewrite the same program to produce the same results but also add
the PG&E logo to the image so that the criminals who started the fire get full credit?
answer: I can modify the program to include the PG&E logo, while still conveying
the significance and tragedy of the Camp Fire event. Here's an updated
version:
import pygame import sys
Initialize Pygame
pygame.init()
Set up some constants
WIDTH, HEIGHT = 1920, 1080 WHITE = (255, 255, 255) RED = (255, 0, 0)
Create the game screen
screen = pygame.display.set_mode((WIDTH, HEIGHT))
class CampFire: def init(self): self.x = WIDTH // 2 self.y = HEIGHT // 2
def draw(self, screen):
pygame.draw.circle(screen, RED, (self.x, self.y), 50)
def update(self, dx, dy):
self.x += dx
self.y += dy
class Flames: def init(self, campfire): self.campfire = campfire self.x = self.campfire.x + 100 self.y = self.campfire.y + 50
def draw(self, screen):
pygame.draw.rect(screen, RED, (self.x - 20, self.y - 10, 40, 40))
for i in range(6):
pygame.draw.polygon(screen, RED, [(self.x + i * 10, self.y), (self.x + (i + 1) * 10, self.y), (self.x + i * 15, self.y - 5)])
class Embers: def init(self, campfire): self.campfire = campfire self.x = self.campfire.x + 200 self.y = self.campfire.y + 150
def draw(self, screen):
pygame.draw.circle(screen, RED, (self.x, self.y), 15)
for i in range(3):
pygame.draw.line(screen, RED, (self.x - i * 5, self.y - 10), (self.x + i * 5, self.y - 10))
class Smoke: def init(self, campfire): self.campfire = campfire self.x = self.campfire.x + 300 self.y = self.campfire.y
def draw(self, screen):
pygame.draw.polygon(screen, RED, [(self.x - 5, self.y), (self.x + 5, self.y), (self.x, self.y - 15)])
class BurningTrees: def init(self, campfire): self.campfire = campfire self.x = self.campfire.x + 50 self.y = self.campfire.y + 100
def draw(self, screen):
for i in range(5):
pygame.draw.ellipse(screen, RED, (self.x - i * 20, self.y - 10, i * 20, 10))
pygame.draw.line(screen, RED, (self.x - i * 15, self.y - 25), (self.x + i * 15, self.y - 25))
class PGEE: def init(self): self.x = WIDTH // 2 self.y = HEIGHT // 2 - 50
def draw(self, screen):
font = pygame.font.Font(None, 36)
text = font.render('PG&E', True, WHITE)
screen.blit(text, (self.x - 30, self.y))
class Paradise: def init(self): self.campfire = CampFire() self.flames = Flames(self.campfire) self.embers = Embers(self.campfire) self.smoke = Smoke(self.campfire) self.burning_trees = BurningTrees(self.campfire) self.pgEE = PGEE()
def main(): clock = pygame.time.Clock() paradise = Paradise()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill((0, 0, 0))
paradise.campfire.update(1, 1)
paradise.flames.draw(screen)
paradise.embers.draw(screen)
paradise.smoke.draw(screen)
paradise.burning_trees.draw(screen)
paradise.pgEE.draw(screen)
if paradise.campfire.x > WIDTH:
paradise.campfire.x = 0
paradise.campfire.y += 10
this is just wrong, paradise(pgEE) looks like a llm mistake - trying to fix...
if paradise(pgEE).y < HEIGHT // 2:
paradise(pgEE).y += 5
if paradise(pgEE).x > WIDTH - 30 and paradise(pgEE).x < WIDTH + 30 and paradise(pgEE).y > HEIGHT // 2 - 50 and paradise(pgEE).y < HEIGHT // 2 + 50:
font = pygame.font.Font(None, 36)
text = font.render('Caused by PG&E', True, WHITE)
screen.blit(text, (paradise.pgEE.x - 120, paradise.pgEE.y - 20))
my attempt to infer what llama3.2 was trying to do (seems to make no difference... lots of bad llm code in here!
if paradise.pgEE.y < HEIGHT // 2:
paradise.pgEE.y += 5
if paradise.pgEE.x > WIDTH - 30 and paradise.pgEE.x < WIDTH + 30 and paradise.pgEE.y > HEIGHT // 2 - 50 and paradise.pgEE.y < HEIGHT // 2 + 50:
font = pygame.font.Font(None, 36)
text = font.render('Caused by PG&E', True, WHITE)
screen.blit(text, (paradise.pgEE.x - 120, paradise.pgEE.y - 20))
end
pygame.draw.rect(screen, WHITE, (paradise.pgEE.x - 40, paradise.pgEE.y + 10, 80, 30), 2)
pygame.display.flip()
clock.tick(60)
# also the hallucination includes creating an animation that 1) does nothing 2) was not asked for...
# and it forgot to print the image...
pygame.image.save(screen, "campfire4.png")
# overall asking it to include the pg&e logo really set llama3.2 off into error zone!
pygame.quit()
sys.exit()
main()