Giter VIP home page Giter VIP logo

memory-game's People

Contributors

marina-ferreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

memory-game's Issues

Flip não funciona

Estou seguindo o tutorial e tentando reproduzir o código, porém ao clicar na carta ocorre apenas o efeito de clique, sem o flip e a mudança de imagem. Não está aparecendo nenhuma mensagem de erro então não consigo identificar o que pode estar errado. Gostaria de ajuda caso alguém tenha encontrado o mesmo problema.

Bad examples leads to bad developers

1. Destructive assignment in this simple case?

 function resetBoard() {
    [hasFlippedCard, lockBoard] = [false, false];
    [firstCard, secondCard] = [null, null];
  }

Easily replaces with

 function resetBoard() {
    hasFlippedCard =  lockBoard = false;
    firstCard = secondCard = null
  }

2. Shuffle is incorrect

Code flow: shuffle is not uniform

Try to count how often vue turns out on top-left card

Code style

(function shuffle() {
    cards.forEach(card => {
      let ramdomPos = Math.floor(Math.random() * 12);
      card.style.order = ramdomPos;
    });
  })();

let should be replaced with const
12 should be replaced with cards.length
moreover why you use IIFE here? you could simply write

// shuffle elements
cards.forEach(card => {
    const ramdomPos = Math.floor(Math.random() * cards.length); 
    card.style.order = ramdomPos;
});

3. It is a de-facto standard to use brackets in if statements (even in one-liners)

if (lockBoard) {return;}
if (this === firstCard) {return;}

And there are plenty more...

No license

I came across your memory sample project and I think this is really nice work. Ideally I would like to use your code for an educational project for new colleagues but given you have not put any license I don't want to do it. Did you intentionally not include a licence or did you simply forget to use it? @marina-ferreira

Difficulty navigating

At the start of the game not all the cards are displayed so there is a problem of usability, also the menu is not readable.

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.