Coder Social home page Coder Social logo

memory's Introduction

Logo for memory memory

A simple memory game using socket.io

Running it

There are no components that need to be compiled, so you can simply use node . to run the server.

By default, it runs on port 8000 if $PORT is not set.

Playing it

Put in a username to join the lobby. You can create a game there, where you can only have one game going on at a time. A game password is also possible to lock the game down against intruders โ€“ this helps when you only want to play with a friend.

A game must have an author and an opponent present at the same time to be started. After that, just flip cards and try to match them and don't cheat.

If the author leaves, the game is removed. If the opponent leaves, the slot remains free again and someone else (or the one who left) can join the game. It will continue as usual.

Fixing it

Messy protocol

This is basically an experiment in using socket.io to synchronise game states. There are some sanity checks in place for incoming data, but there is no full coverage for all commands. Additionally, there may be certain cases where the synchronisation goes wrong.

One case that's known is the lack of synchronisation for playing a single card and then leaving as an opponent. This messes up the game for a single turn, but gets fixed right after.

Further testing is required to figure these issues out and patch them.

Interface for errors

The only remaining feature that's necessary to have is error handling in the user interface. Currently, most errors are not handled by the server either; most commands simply silently fail if they cannot be performed. It's a good idea to have errors showing up for incorrect passwords or attempts to play in your opponent's turn.

Card themes

Not exactly an issue, but an option to switch the card themes should be easy to implement.

Cowboy code

There wasn't a clear picture in my mind when I began making this, so the code is messier than it should be. However, it is still quite short and... mostly legible.

I will try to address this in the near future.

memory's People

Contributors

evrimoztamur avatar

Watchers

 avatar

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.