Coder Social home page Coder Social logo

ruby-blackjack's Introduction

  /$$$$$$$  /$$                     /$$                               /$$
 | $$__  $$| $$                    | $$                              | $$
 | $$  \ $$| $$  /$$$$$$   /$$$$$$$| $$   /$$ /$$  /$$$$$$   /$$$$$$$| $$   /$$
 | $$$$$$$ | $$ |____  $$ /$$_____/| $$  /$$/|__/ |____  $$ /$$_____/| $$  /$$/
 | $$__  $$| $$  /$$$$$$$| $$      | $$$$$$/  /$$  /$$$$$$$| $$      | $$$$$$/
 | $$  \ $$| $$ /$$__  $$| $$      | $$_  $$ | $$ /$$__  $$| $$      | $$_  $$
 | $$$$$$$/| $$|  $$$$$$$|  $$$$$$$| $$ \  $$| $$|  $$$$$$$|  $$$$$$$| $$ \  $$
 |_______/ |__/ \_______/ \_______/|__/  \__/| $$ \_______/ \_______/|__/  \__/
 ┌───────────────────────────────────┐  /$$  | $$ ┌─────────────────────────────┐
 └───────────────────────────────────┘ |  $$$$$$/ └─────────────────────────────┘
 Built on Ruby                          \______/
 Version 1.01
 by Will Wang @ www.hantaowang.me

======

Background

I taught myself Ruby originally because I wanted to learn Rails and eventually also at the recommendation of my girlfriend, who had a wonderful introduction to Ruby textbook. I wanted my first major ruby program to be a blackjack game, which was also my first major program in Python.

As it turns out, blackjack is a great program to test out the basics of a language, as it incorporates ideas such as flow control, iteration, arrays, mathematics, etc. This ruby implementation of blackjack is also my first to use object-orientated programming. The classes are defined in the objects.rb file.

How to play

To run the game, you need to have Ruby downloaded and a command line interpreter such as Terminal or Gitbash installed. If you are running MacOS, then you already have both preinstalled. For Windows users, Ruby can be downloaded here. Download the files and run ruby blackjack.rb to begin. Instructions on how to play blackjack are provided in game.

Interesting Note

This implemenation of blackjack is set up like how it would be at the casino: with a 6-deck stack called a "shoe," from which cards are drawn without replacement and refilled when needed. Because of this, it is possible to actually count cards or at least practice card counting without being kicked out of the casino.

More like this

This project was built by Hantao (Will) Wang. Find out more about me on my website!

ruby-blackjack's People

Contributors

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