Giter Site home page Giter Site logo

cardcounter's Introduction

cardcounter

A simple CL program that counts cards and advises on whether to hit or not in a game of 十點半.

Usage

The program keeps track of a deck and your hand. There are two modes

  • Hit Mode: card codes result in the corresponding card being added to the hand and removed from the deck
  • Normal Mode: card codes result in the corresponding card being removed from the deck only While in Hit Mode, the program will advise you on whether to hit or not when a new card is added to the deck. Normal Mode is used to keep the deck up to date when cards are dealt to other players.

The program uses a distribution monad to model the probabilistic computation following Oleg Kiselyov's lecture at FLOLAC'16.

Run

Make sure you have stack installed on your system, then run

stack build

to install the necessary dependencies and create the executable. Start the CL program with

stack exec cardcounter-cl

Available commands

  • A Toggle between Hit Mode or Normal Mode
  • R Restart Deck
  • F Flush Hand
  • D Show Deck
  • H Show Hand
  • U Undo previous command

Card Codes

  • 1 A
  • 2 2
  • ...
  • 9 9
  • 0 10
  • j J
  • q Q
  • k King
  • l Joker

cardcounter's People

Stargazers

Daniel Kahlenberg avatar

Watchers

James Cloos avatar Leo 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.