Giter VIP home page Giter VIP logo

war's Introduction

This project was bootstrapped with Create React App.

War the card game built on NodeJS, React, and Socket.IO

To Run

Clone and install dependencies: npm install.
Start the socket server: node ./src/socket.js
Start the React UI: npm start

To Play

React should automatically launch a tab to localhost in your default browser. If not, visit http://localhost:3000 (unless you specified a diffferent port during startup)

You will be prompted to enter a player name upon opening the page. If you're playing by yourself open a second tab and enter a name for that player as well. Once the game has two players, they will both need to click ready to start the game. Each player will have a "Flip" button they will need to click each turn.

More Info

The react components are state based and only update when the server sends updates via the websocket. The "ready" and "flip" buttons are the only client side event triggers. Most of the game logic is located in /src/game, where GameController.js contains the controls for the core game loop.

The other classes either act as object oriented classes(Player.js, Deck.js, Card.js), or similar to an enum to reduce repetitive string comparisons(Suit.js, PlayerType.js, GameState.js).

I wanted to do a bit more with the spectators. Potentially having the next spectator in line replace the loser as the next player, but unfortunately I was running short on time.

war's People

Contributors

scottm85 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.