jeopardy/CLAUDE.md
2026-05-06 19:39:08 -07:00

2.1 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is a Jeopardy-style quiz application built with LÖVE (Love2D) game framework in Lua. The project uses two custom libraries:

  • multi (v16.3.0) - A multitasking library for Lua with coroutine-based threading, system threads, and priority management
  • gui (GuiManager) - A UI library built on top of multi for LÖVE-based interfaces

Running the Application

# Run with LÖVE
love .

# Run tests
lua main-test.lua

Architecture

Core Modules

Module Path Purpose
main.lua Root LÖVE entry point with love.load(), love.update(), love.draw()
board.lua Root Builds the Jeopardy game board UI
task_manager.lua Root Manages game flow and question handling
loader.lua Root Loads question data from YAML files
yaml.lua Root YAML parser
multi/ Library Multitasking library with threading support
gui/ Library UI framework with frames, buttons, textboxes, images

Key Patterns

multi library usage:

multi, thread = require("multi"):init({print = true, priority=true})
GLOBAL, THREAD = require("multi.integration.loveManager"):init()

-- Create threads
multi:newThread("Name", function()
    while true do
        thread.sleep(1)
        -- do work
    end
end)

-- Run in love.update()
multi:uManager(dt)

gui library usage:

local gui = require("gui")
local color = require("gui.core.color")

gui:setAspectSize(1920, 1080)
local frame = gui:newFrame(x, y, w, h, sx, sy, sw, sh)
frame.color = color.new("#hex")

Data Format

Questions are loaded via loader.lua from YAML files with structure:

  • index.yaml - Contains categories and settings
  • <category>.yaml - Contains questions for each category

Integration Points

  • multi.integration.loveManager - Bridges multi threading with LÖVE's event loop
  • gui.update(dt) and gui.draw() - Called from love.update() and love.draw()
  • UI uses aspect ratio scaling (1920x1080 base)