Skip to content

dbasch/letris

Repository files navigation

Letris

A Tetris-inspired word game where falling letters are used to form words and clear the board.

This project was co-created by the user and an AI assistant (vibecoded).

How to Play

  1. Letters fall from the top of the screen, one at a time.
  2. Use the arrow keys on your keyboard to move the falling letter left or right.
  3. Press the down arrow key to make the letter fall faster.
  4. Press the spacebar to make the letter drop immediately to the bottom.
  5. On mobile devices, on-screen touch controls are available for Left, Right, Down, and Drop.
  6. Form words of 4 or more letters horizontally or vertically.
  7. When a valid word is formed, it will be cleared from the board, and you'll score points.
  8. The game ends if the letters stack up to the top of the board.

Features

  • Classic Tetris-like falling block gameplay with a word-forming twist.
  • Dynamic scoring based on the length of the words formed.
  • Dictionary-based word validation.
  • Responsive design with on-screen controls for mobile play.
  • Letter frequency modeled on English language for a balanced gameplay experience.

Tech Stack

  • HTML: Structure of the game page.
  • CSS: Styling for the game interface and responsiveness.
  • JavaScript (Vanilla): All game logic, including piece movement, word detection, scoring, and rendering.
  • Python: A utility script (process_words.py) is used to process a raw word list (words.txt) into a JSON dictionary (simple_dictionary.json) for the game.

File Structure

  • index.html: The main HTML file that sets up the game page and canvas.
  • styles.css: Contains all CSS rules for styling the game elements and mobile responsiveness.
  • game.js: The core JavaScript file containing all game logic, including piece control, grid management, word checking, scoring, and drawing.
  • simple_dictionary.js: JavaScript to load and manage the word dictionary (simple_dictionary.json) used for word validation.
  • simple_dictionary.json: The processed list of valid words used by the game (generated by process_words.py).
  • words.txt: A raw text file containing a list of words, one per line. This is the source for simple_dictionary.json.
  • process_words.py: A Python script to read words.txt, filter words (e.g., by minimum length), and create simple_dictionary.json.
  • vercel.json: Configuration file for deploying to Vercel.

Local Development

  1. Ensure you have a web browser.
  2. If you modify words.txt or the filtering criteria in process_words.py, run the Python script to update the dictionary:
    python process_words.py
  3. Open the index.html file in your web browser to play the game locally.

Deployment

This game is configured for easy deployment to Vercel.

  1. Install the Vercel CLI: npm install -g vercel
  2. Log in to Vercel: vercel login
  3. Link your local project to a Vercel project (if not already done):
    vercel link
  4. Deploy to production:
    vercel --prod

Authorship

This project was developed by the user with assistance from an AI (vibecoded).

About

A Tetris-inspired game where you form words with falling letters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors