Files
gamercomp/backend/scripts/regenerate-all-games.js
T
2026-04-30 02:14:25 +00:00

279 lines
6.7 KiB
JavaScript

require('dotenv').config();
const { pool } = require('../src/models/db');
const { generateGame } = require('../src/utils/claude');
const allGames = [
{
id: 14,
title: "Snake",
prompt: `Classic Snake game - mobile-first with sound.
MOBILE CONTROLS:
- Swipe anywhere to change direction
- Also add semi-transparent d-pad buttons at bottom (up/down/left/right)
GAMEPLAY:
- Snake starts moving right automatically
- Eating apple grows snake, adds 10 points
- Game over on wall/self collision
- Speed increases every 5 apples
SOUNDS: Eat sound (high beep), game over (low tone), background beat`
},
{
id: 15,
title: "Tetris",
prompt: `Tetris falling blocks - mobile-first with sound.
MOBILE CONTROLS:
- Tap left half to move left, right half to move right
- Swipe down for drop
- Tap piece or swipe up to rotate
- Add visible buttons at bottom: [←] [→] [↻] [↓]
GAMEPLAY:
- 7 tetromino shapes, auto-falling
- Clear lines for points (100/300/500/800)
- Show next piece
- Speed increases each level
SOUNDS: Move (click), rotate (whoosh), line clear (ding), game over`
},
{
id: 16,
title: "Pong",
prompt: `Pong paddle game - mobile-first with sound.
MOBILE CONTROLS:
- Touch and drag on YOUR side to move your paddle
- Single player vs AI opponent
GAMEPLAY:
- Ball bounces between paddles
- First to 5 points wins
- Ball speeds up each hit
- AI difficulty increases with score
SOUNDS: Paddle hit (pop), wall bounce (tick), score (ding), win/lose`
},
{
id: 17,
title: "Breakout",
prompt: `Breakout brick breaker - mobile-first with sound.
MOBILE CONTROLS:
- Touch anywhere and drag to move paddle
- Paddle follows finger X position
- Tap to launch ball from paddle
GAMEPLAY:
- Colorful brick rows at top
- Ball bounces off paddle to break bricks
- Each brick = 10 points
- 3 lives, lose one when ball falls
SOUNDS: Brick break (pop), paddle hit (thud), ball launch (whoosh), life lost`
},
{
id: 18,
title: "Space Invaders",
prompt: `Space Invaders shooter - mobile-first with sound.
MOBILE CONTROLS:
- Large [←] and [→] buttons at bottom corners
- Large [FIRE] button at bottom center
- Touch zones: left third moves left, right third moves right, center fires
GAMEPLAY:
- Alien grid moves and descends
- Shoot aliens for points (10-50 per row)
- Aliens shoot back randomly
- 3 lives, clear all aliens to win wave
SOUNDS: Shoot (pew), alien hit (explosion), player hit (boom), march beat`
},
{
id: 19,
title: "Pac-Man",
prompt: `Pac-Man maze game - mobile-first with sound.
MOBILE CONTROLS:
- Swipe in direction to change Pac-Man direction
- Also add d-pad overlay at bottom of screen
GAMEPLAY:
- Simple 15x15 maze
- Eat dots (10pts) and power pellets (50pts)
- 4 ghosts chase, turn blue when powered
- Eat blue ghosts for bonus (200pts)
- 3 lives
SOUNDS: Wakka-wakka eating, power pellet sound, ghost eaten, death`
},
{
id: 20,
title: "Flappy Bird",
prompt: `Flappy Bird - mobile-first with sound.
MOBILE CONTROLS:
- TAP ANYWHERE on screen to flap
- That's the only control - dead simple
- Entire game canvas is the tap zone
GAMEPLAY:
- Bird falls with gravity
- Tap to flap up
- Pass through pipe gaps
- Each pipe = 1 point
- Game over on any collision
SOUNDS: Flap (whoosh), score (ding), hit (thud), background wing beat`
},
{
id: 21,
title: "2048",
prompt: `2048 number puzzle - mobile-first with sound.
MOBILE CONTROLS:
- SWIPE in any direction to slide tiles
- Must detect swipe vs tap
- Minimum swipe distance: 30px
GAMEPLAY:
- 4x4 grid
- Swipe merges matching numbers
- New tile after each move
- Win at 2048, game over when stuck
SOUNDS: Slide (swoosh), merge (pop - higher pitch for bigger numbers), game over`
},
{
id: 22,
title: "Minesweeper",
prompt: `Minesweeper - mobile-first with sound.
MOBILE CONTROLS:
- TAP to reveal cell
- LONG PRESS (0.5s) to flag/unflag
- Cells must be large enough to tap (40px minimum)
GAMEPLAY:
- 9x9 grid, 10 mines
- Numbers show adjacent mines
- First tap always safe
- Flag all mines to win
SOUNDS: Reveal (click), flag (flag sound), mine (explosion), win (fanfare)`
},
{
id: 23,
title: "Asteroids",
prompt: `Asteroids space shooter - mobile-first with sound.
MOBILE CONTROLS:
- Left side: two buttons for rotate left/right
- Right side: THRUST button and FIRE button
- Virtual joystick alternative: drag to rotate, tap to thrust
GAMEPLAY:
- Ship in center with momentum physics
- Shoot asteroids to break them
- Large→Medium→Small
- Screen wrapping
- 3 lives
SOUNDS: Thrust (rumble), shoot (pew), asteroid break (boom), ship explode`
},
{
id: 24,
title: "Frogger",
prompt: `Frogger road crossing - mobile-first with sound.
MOBILE CONTROLS:
- D-pad at bottom: up/down/left/right buttons
- Or SWIPE in direction to hop
- Each input = one grid hop
GAMEPLAY:
- Cross road (avoid cars) then river (ride logs)
- Grid-based movement
- 5 home spots to fill
- 30 second timer per frog
- 3 lives
SOUNDS: Hop (boing), car hit (splat), water splash, home safe (ding)`
},
{
id: 25,
title: "Simon Says",
prompt: `Simon Says memory game - mobile-first with sound.
MOBILE CONTROLS:
- Four LARGE colored buttons (2x2 grid)
- Each button at least 100px
- Tap to select color
GAMEPLAY:
- Watch pattern light up
- Repeat by tapping buttons
- Pattern grows each round
- Wrong tap = game over
SOUNDS: Each color has unique tone (do, re, mi, fa), error (buzz), round complete (fanfare)`
}
];
async function regenerateGame(gameData) {
console.log(`\nRegenerating: ${gameData.title} (ID: ${gameData.id})...`);
try {
const result = await generateGame(gameData.prompt);
if (!result.success) {
console.error(` FAILED: ${result.error}`);
return false;
}
await pool.query(
`UPDATE games SET game_code = $1, prompt = $2 WHERE id = $3`,
[result.code, gameData.prompt, gameData.id]
);
console.log(` SUCCESS: ${gameData.title}`);
return true;
} catch (error) {
console.error(` ERROR: ${error.message}`);
return false;
}
}
async function main() {
console.log('='.repeat(50));
console.log('REGENERATING ALL GAMES');
console.log('Mobile-first + Sound Effects + Music');
console.log('='.repeat(50));
let success = 0;
let failed = 0;
for (const game of allGames) {
const ok = await regenerateGame(game);
if (ok) success++; else failed++;
// Delay between API calls
await new Promise(r => setTimeout(r, 2000));
}
console.log('\n' + '='.repeat(50));
console.log(`COMPLETE: ${success} success, ${failed} failed`);
console.log('='.repeat(50));
await pool.end();
process.exit(failed > 0 ? 1 : 0);
}
main().catch(err => {
console.error('Fatal:', err);
process.exit(1);
});