Skip to content

fabiopsh/tetris-on-solidjs

Repository files navigation

🧱 Tetris on SolidJS

SolidJS TypeScript Vite

A fully functional Tetris clone built from scratch in under 60 minutes.

This project was created as a preparatory exercise for the Advanced Programming exam at the University of Pisa (MSc in Computer Science / ICT Solution Architect), taught by Prof. Antonio Cisternino.

The goal was not to create a polished product, but to challenge the capabilities of SolidJS's fine-grained reactivity and to test rapid prototyping skills under time constraints.


⚡ The Challenge: "1-Hour Sprint"

  • Constraint: ~1 Hour of coding time.
  • Goal: Implement core mechanics (Grid, Tetrominos, Gravity, Collision, Line Clearing).
  • Stack: SolidJS + TypeScript.

Why SolidJS?

Unlike React, SolidJS does not use a Virtual DOM. Instead, it compiles its templates to real DOM nodes and updates them with fine-grained reactions. For a game loop like Tetris, this ensures high performance and direct state management without unnecessary re-renders.

🎮 Features Implemented

Despite the short timeframe, the core mechanics are operational:

  • Game Loop: Managed via requestAnimationFrame or setInterval for gravity.
  • Collision Detection: Wall kicks and floor collision logic.
  • State Management: Using SolidJS Signals and Stores for the grid and active piece.
  • Rendering: Reactive rendering of the 10x20 grid.

🚀 How to Run

This project uses Vite for a lightning-fast development server.

1. Clone & Install

git clone [https://github.com/fabiopsh/tetris-on-solidjs.git](https://github.com/fabiopsh/tetris-on-solidjs.git)
cd tetris-on-solidjs
npm install

2. Run the Project

npm run dev

3. Build the Project

npm run build

About

A Tetris project done in 1H with the help of AI for the course of Advanced Programming in the University of Pisa.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors