Coder Social home page Coder Social logo

salvinha-vlc / blackjack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ta-data-bcn/project-week-1-build-your-own-game

0.0 1.0 0.0 29 KB

Let's have some fun playing Blackjack! It has been programmed in Python. The final version is rendered in both Jupyter notebook and PyCharm.

Jupyter Notebook 58.62% Python 41.38%

blackjack's Introduction

Ironhack Logo

Python Casino Blackjack

Salvador Rocher Espinosa

Data Analytics, Barcelona, July-19

Content

Project Description

This projects presents a single-player blackjack game where one play against the dealer (computer). Games are in my opinion a good way to kick things off in Python, and Blackjack gathers the conditions to practice loops, functions, nested functions, and logical conditions all together in the mix. Besides it is fun! Try to beat the casino while managing your bankroll.

The code final version is rendered in both Jupyter notebook and PyCharm and can be found in "your-code" folder.

Rules and Settings

This game is a somewhat simplified version of what the casino Blackjack is in real life. Here are some details.

First, the script will ask you how much cash you want to draw to sit on the Blackjack table. Minimum is 50€, max is 500€. Then, you will have to bet before the cards are dealt - minimum 50€ and maximum as much money as you have left.

After this, 2 cards are dealt face up to both the player (you) and the dealer. The face value of each card is, in case of them being numbers, its respective number in points, and in case of figures, if it is not an ace, 10 points, and if it is an ace, the script will ask you what you want to do with each of them (in case there is more than 1 in your initial hand), that is, whether you want to make them to count 1 or 11 points. The goal is to get as close to 21 points but without exceeding it. You play first, that is, you can either stick or ask for more cards, this time, in each subsequent round you will just be dealt with 1 card. If your hand goes beyond 21 points, you automatically lose your bet.

If you have stuck before exceeding 21 points or just got the 21 points, dealer is programmed to continue to play as long as its hand's value is below 17 points or as long as its hand is lower than yours.

Whenever the results of the round are a tie at the end, the pot is split which means you get your initial bet back, no casino rack/commisions have been defined in this game.

If there is blackjack in the initial showdown:

  • Loss/gain is 1.5x the bet amount (as long it does not exceed your bankroll in case of loss)
  • If there would be a tie in the initial showdown to 21, dealer wins.

Workflow

1º Understanding the game and defining the rule boundaries of my version 2º Structuring the sequence of actions that comprise the game 3º Drafting the code as per the structure chosen 4º Writing the code in a basic version 5º Developing the code to an enhanced version 6º Preparing the slides and the presentation 7º Presenting the project

Organization

I first drafted a plan of the code on paper (pseudo-code) and set the sequence of tasks to follow in trello.

Links

Include the links to your repository, slides and trello. Feel free to include any other links associated to your project.

[Repository] https://github.com/Salvinha-vlc/Project-Week-1-Build-Your-Own-Game
[Trello] https://trello.com/b/aRH6SA2E/proyecto-1

blackjack's People

Contributors

salvinha-vlc avatar evapanizo avatar

Watchers

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