You’ve braved the stormy seas of console output and now it’s time to dock at the glorious graphical port: Pygame!
Today’s mission: Bring your Battleship board to life using graphics.
You won’t be placing ships or battling just yet—your task is to display your board as a clean, clickable Pygame grid.
You're not coding the whole game in Pygame today—just getting the visual board on screen. This is the digital blueprint for your naval domination. If you can draw it, you can rule it.
✅ Use pygame.Rect() to create each square
✅ Draw outlines only — no filled blocks (use width=1)
✅ Build a 10x10 grid that looks like a classic Battleship board
✅ Add column labels (A–J) and row numbers (1–10)
✅ Make sure your squares are spaced out evenly
✅ Use screen.fill() for the background
✅ Test different colors for fun!
import pygame
pygame.init()
screen = pygame.display.set_mode((600, 600))
pygame.display.set_caption("Battleship Grid")
BG_COLOR = (0, 0, 128)Â Â Â Â # Dark blue
LINE_COLOR = (255, 255, 255)Â # White lines
screen.fill(BG_COLOR)Â
pygame.display.flip()Â
pygame.quit()Â