Skip to content

♠️ A Haskell library for writing bots that play Chinese Poker

License

Notifications You must be signed in to change notification settings

benperez/chinese-poker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chinese-poker

A Haskell library to help users—both human and computer—play Chinese Poker against one another.

Goals

The goal of this project is to create a set of datatypes and functions that represent the game of chinese poker. This core functionality will be used in two ways—to create a server that will allow multiple users (both human and machine) to play games of chinese poker against one another and to facilitate the creation of software that can intelligently play chinese poker on its own.

Organization

The core logic of traditional poker hands is located in src/Hand.hs. This module exports four types—Suit, Rank, Card, and Hand defined as follows:

data Suit = Diamonds | Clubs | Hearts | Spades deriving (Eq, Enum, Ord, Show)

data Rank = Two
          | Three
          -- etc...
          | King
          | Ace
          deriving (Eq, Enum, Ord, Show)

type Card = (Rank, Suit)

data Hand = Hand Card Card Card Card Card deriving (Eq, Show)

Hand is an instance of Ord whose implementation compares seperate Hands according to the traditional rules of poker.

Hand also exposes a function called validateHands that will check to ensure that no cards are repeated in a given set of hands.

validateHands :: [Hand] -> Bool

Setup

To build the project, just run make setup in the top-level directory.

Tests

The tests are written using Hspec. To run the tests, simply type make test.

About

♠️ A Haskell library for writing bots that play Chinese Poker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published