Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L'Eco-Mémo — Eco-Actitude Memory Game

PHP Laravel Livewire SQLite PHPUnit MIT Licensed

Source code for L'Eco-Mémo, the memory game of Eco-Actitude: find the 9 pairs of zero-waste products and learn an eco-friendly fact with each match.

The whole game runs in a single Livewire component (MemoryGame) with its state persisted in the session, so a game in progress survives a page reload.

The game

Home

dashboard.png

Board

18 cards (9 pairs), shuffled at every new game:

game.png

Rules & scoring

success.gif error.gif
🟢 The two cards match: they stay face up and you score 10 + combo × 5 points. 🔴 The two cards differ: they turn red, flip back after 800 ms, the attempt counter increases and you lose points.
  • A combo is the number of pairs found in a row; it resets on every miss.
  • Each matched pair scores 10 + combo × 5 points (15 for the first match, 20 for the second in a row, 25 for the third…).
  • Each miss costs 1 point when the score is below 10, otherwise 10% of the score.

Combo bonus

Chain pairs without missing and a combo badge pops on the board while the bonus grows:

combo.gif

« Le saviez-vous ? »

Every matched pair reveals an eco-fact about the product (recycled paper, solid soap, dishwasher tablets…), displayed under the board.

End of game

Once all pairs are found, you can save your score (name validation + rate limiting: 3 saves per minute per IP) and see the top 15 on the high-scores page.

endgame.png

Back-end install

Requirements

cd project
composer install

.env file

Copy .env.example to .env in the project/ directory (local defaults use SQLite and file-based cache/sessions), then generate the app key:

cp .env.example .env
php artisan key:generate

Database

php artisan migrate
php artisan db:seed

The seeder inserts the 9 card pairs on first run and refreshes their captions and eco-facts on subsequent runs, so it is safe to re-run after a deploy.

Front-end install

Requirements

Assets are compiled with Laravel Mix (SCSS + JS, minified to public/css/app.min.css and public/js/app.min.js):

npm install
npm run development   # dev build
npm run production    # minified build
npm run start         # watch mode

Tests

The feature test suite covers the whole game loop (matching, mismatching, combos, eco-facts, end of game, score saving and validation) against an in-memory SQLite database:

./vendor/bin/phpunit

Scripts

  • scripts/refresh_cache.sh — clears and rebuilds the config/route caches, and resets OPcache outside the local environment.
  • scripts/build_ftp_package.sh — builds a self-contained FTP deployment bundle (deploy-ftp/) for shared hosting without SSH access: production assets, zipped vendor directory, one-shot extraction/migration scripts and step-by-step instructions.

About

Source code for Eco-Actitude Memory Quest

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages