mh2795 / war-game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

War Game

This project is a rendition of the War card game built exclusively with JavaScript and played in the browser console! The obejctive of this project was to transform War game logic into lines of code and better understand programmatic thinking and Object Oriented Programming.

Getting Started

Defined below are:

  • Rules of the game
  • How to play

Rules of the Game

The goal is to be the first player to win all 52 cards

THE DEAL

The deck is divided evenly, with each player receiving 26 cards, dealt one at a time, face down. Anyone may deal first. Each player places their stack of cards face down, in front of them.

THE PLAY

Each player turns up a card at the same time and the player with the higher card takes both cards and puts them, face down, on the bottom of his stack.

If the cards are the same rank, it is War. Each player turns up three cards face down and one card face up. The player with the higher cards takes both piles (10 cards). If the turned-up cards are again the same rank, each player places another three cards face down and turns another card face up. The player with the higher card takes all 18 cards, and so on.

HOW TO KEEP SCORE

The game ends when one player has won all the cards.

How to PLay (Instructions)

  1. Open the index.html file in this repository in your browser
  2. Go to the console in your dev tools
  3. Call the deck.play() function in the console
  4. Enjoy!

Built With

  • JavaScript
  • VS Code
  • GitHub

Authors

See also the list of contributors who participated in this project.

License

This project is not licensed but please don't steal my work without giving me credit   đź‘€

Acknowledgments

  • Credits to Fisher-Yates for the algorithm utilized in this project to shuffle the deck prior to dealing
  • Inspired by the original War card game
  • Rules of the Game sourced from Bicycle Cards

About


Languages

Language:JavaScript 94.8%Language:HTML 5.2%