Skip to content

quantcat26/poker_game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Poker Game

Overview

This project is a single-player poker game that runs in the browser and communicates with a Node.js game server.

When the game starts, both the player and the computer receive five cards. The player can replace selected cards up to two times before confirming the hand. After confirmation, the server reveals the computer's hand and determines the winner using poker hand rankings.

Project Structure

  • game_server.js - main server program
  • deck.js - deck management utilities
  • package.json - project dependencies
  • public/index.html - browser entry point
  • public/style.css - page styling
  • public/scripts/hand.js - card rendering and card click handling
  • public/scripts/poker_game.js - main browser-side game logic

Requirements

  • Node.js
  • npm

Setup

Install the required packages:

npm install

Start the server:

node game_server.js

Open the game in your browser:

http://localhost:8000

How to Play

  1. Click Start Game to receive your first five cards.
  2. Click cards to flip them for replacement.
  3. Click Replace Cards to send the selected cards to the server.
  4. You can replace cards at most two times.
  5. When you are satisfied, click Confirm the Hand to finish the game.
  6. The server will show the computer's hand and display the winner.

Server Endpoints

The browser communicates with the server using these endpoints:

  • GET /start - starts a new game and returns the player's hand in JSON format
  • POST /replacecards - replaces selected cards and returns the updated hand in JSON format
  • GET /confirm - ends the game and returns the result in JSON format

Notes

  • The game uses poker hand comparison rules to decide the winner.
  • The browser and server code are both part of the lab implementation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors