Coder Social home page Coder Social logo

fm-memory-game-challenge's Introduction

Frontend Mentor - Memory game solution

wakatime

This is a solution to the Memory game challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the game depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Play the Memory game either solo or multiplayer (up to 4 players)
  • Set the theme to use numbers or icons within the tiles
  • Choose to play on either a 6x6 or 4x4 grid

Screenshot

demo demo

Links

My process

  1. create test first approches (TDD)
  2. implements logic without styling
  3. add styling mobile first (no test to validate styling)
  4. add media queries for responsiveness

Built with

What I learned

I am sticking to the TDD lifecycle and what I learn most is about how use Timer Mocks with jest. Indeed, there is a need to implement a Timer function for displaying the total time past in the game. I also needed some sort of "time-based flip-flop switch" in order to delay the resolution of the tiles states.

  • jest.useFakeTimers
  • jest.advanceTimersByTime

Hooks useRef where really usefull because I need to work with the same timer instance when displaying the Menu or restarting the game.

Useful resources

Timer Mocks

Author

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.