How barbacoa08/andesite-battleship works
Project type and purpose
• This is a React-and-TypeScript single-page application (SPA) that implements a 1v1 Battleship game.
• It lives entirely in the browser, is hosted as static assets (Netlify), and has no separate backend service in this repo.
• Key purpose: deliver an interactive Battleship UX (drag-and-drop setup, turn-based play) with all game logic on the client.
File structure
• Top-level files and config:
– index.html, netlify.toml → static entry point + hosting config
– package.json, pnpm-lock, pnpm-workspace → monorepo/package manager setup
– tsconfig.*, vite.config.ts → TypeScript + build config
– .github/workflows → CI for lint/tests
• src directory breakdown:
– src/main.tsx → React app bootstrap
– src/Router.tsx → client-side routing (Home vs Battleship pages)
– src/GlobalContext.tsx → React Context for shared game state
– src/pages → high-level views: Home.page.tsx, Battleship.page.tsx
– src/components → UI building blocks, including Battleship (board, messages, headers, drag-and-drop logic), Welcome, ToDos
– src/components/Battleship/utils → core game algorithms (auto-place, place-ship, starting-board, rotation handler, use-game-state hook)
– test-utils + vitest.config → local testing setup
README for additional insights
• Focus areas: gameplay UX, APIs (functions/hooks for game logic), code structure.
• No mention of server or database—everything is client-side.
• CI/CD expectations: demo the working app, discuss tradeoffs, reliability, scaling (though minimal back end).