Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

pascal-zarrad/flagbit-memory

 
 

Repository files navigation

The MEMORY-Project

The aim of the project is to implement the Memory card game in the browser using JavaScript.

In Memory, cards with pictures are laid out on the square playing field upside down. Each card is available exactly two times. Each player can open two cards in one move. If the cards show the same image, they remain face-up. Otherwise, you will be turned around again. The aim of the game is to find all pairs of cards as quickly as possible.

The graphical interface of the game has already been implemented in the project folder. The actual logic of the game should be implemented in the file src/js/Classes/GameManager.ts. This has been done satisfactorily if all test cases are run successfully. The tests can be executed with the command "npm run test".

Setup

  1. Run docker-compose up -d
  2. Run npm install

Requirements

  • Requrires docker, docker-compose and npm to be installed

Commands

  • npm run test runs tests
  • npm run watch builds the application and watches for changes
  • npm run build builds the whole application
  • git pull fetches new code from the server
  • git commit commit all current changes to the local repository
  • git push push changes from the local repository to the server
  • git reset --hard origin/current discard local changes

Specifications

The game uses a virtual deck, which is an array of cards. Each cards has an id, an image and a status variable (show) which determines if the card is visible.

let card = {id: 1, image: 1, show: false}

let deck = [
    {id: 1, image: 1, show: false},
    {id: 2, image: 2, show: false},
    {id: 3, image: 2, show: true},
    {id: 4, image: 1, show: false}
]

Tests

You can run a single test with fit instead of it:

// runs all tests
it('should do something', () => {
    // test
});


// runs only this test
fit('should do something', () => {
    // test
});

You can run a single suite with fdescribe instead of describe:

// runs all suites
describe('GameManager', () => {
    // tests
});


// runs only this suite
fdescribe('GameManager', () => {
    // tests
});

Help

Switch Scenario

  • git checkout SCENARIO-1 -- src/js/Classes/GameManager.spec.ts get the advanced tests
  • git checkout SCENARIO-2 -- src/js/Classes/GameManager.spec.ts get the basic tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 48.8%
  • Vue 25.1%
  • JavaScript 24.9%
  • Other 1.2%