Blackjack V1.0

(Simon) #1

@vampirics and I are proud to present Blackjack for the Arduboy.

This implementation plays a ‘unified’ version of the various BlackJack games from different casinos around the world. It allows splits, double up and insurance on a dealer blackjack and so forth. Initially it will be a one-player game (play against the house) but version 2 might allow two players.





The rules are pretty simple.

  • You nominate your starting bet. In this game anywhere from $1 to $200.
  • You and the dealer are then dealt two cards. You can see your hand and you can see the dealers top card. At this point and depending on the cards showing you have a number of choices:
    • If you have a pair you can split them into two hands. You have to double your bet to do this but you can potentially win twice as much. Typically you should split Aces and Eights but never 10s (or picture cards).
    • You can double up. You double your bet and are dealt a single card (at right angles to your normal cards). This is the end of your hand. Best to double up when your had equals 10 or 11.
    • If the dealer has an Ace showing you will be offered an insurance bet. This is a side bet and will pay out if the dealer has BlackJack. An insurance bet effectively offsets you original bet - you win money because the dealer has a Blackjack but you lose on the main hand (unless you too have a blackjack).
  • You then start playing your first hand. You can draw cards to get your hand score as close to 21 as you can without going bust. Aces can be counted as 1 or 11 - your choice.
  • You play your second hand (if you have one).
  • Dealer plays his hand and works out who has won.
    • If you have a black jack, the Dealer pays you out 5:2 (two and a half times your original bet).
    • If you have a non-black jack hand that is better than the dealers, he pays you 2:1 (twice your original bet).
    • If you and the dealer have the same, you get your money back
    • If the dealer has a better hand you lose!


Source >
Hex file >
Online >


Sweet graphics.
Broke the bank? More like “hit the road”

I only know one.

But wait! Why are the cards sideways???
Looking up how to play blackjack…

As the teaser goes it seems like a sweet simple build. :yum:
:face_with_raised_eyebrow: Maybe consider putting the amount of money you had in the EEPROM so you can load the game wen necessary?

(Simon) #3

@vampirics did the graphics. Like always, simple and clean.

Side ways? When you double up. No doubling down in this game.

(Simon) #4

@vampirics has added some new graphics and they look good! If the movie below is not playing then you may need to refresh your browser.


If anyone is interested in playing this (it is still a WIP), you can have a look here:

Source >
Hex file >

(Holmes) #5

This looks awesome for a simple card game!

(Simon) #6

Thanks @crait … there is do doubt that graphics make the game.

Here is a link to play online >

If you load it up on your physical Arduboy, be warned that you need to press the down button from the main / splash screen to enter bootloader mode. I have removed the USB stack due to the size of the graphics.

(Simon) #7

I have buried an Easter Egg in the game … not too deep and a cursory look at the code will probably reveal it.

(Simon) #8

V1.0 is now complete. Please let me know if you find any bugs!


When I try to open the .ino file in Arduino, only this appears as “no such file or directory”:

_#include “src/Game.h” _

#include “src/utils/Enums.h”
#include “src/utils/Arduboy2Ext.h”

_#ifndef DEBUG _

Game game;

void setup() {
_ game.setup();_

void loop() {
_ game.loop();_

(Scott) #10

This game does something that’s not advisable for Arduino sketches. It puts some of the files in subdirectories. You’ll need to put the src directory and all of its contents (including subdirectories within it) in the directory containing the Blackjack.ino file.

(Simon) #11

Yes sorry for that … I use VSCode and not the Arduino IDE and it works fine with subdirectories.

(Scott) #12

To make installation easier, I suggest you create a directory named Blackjack in the root of your GitHub repository then move the Blackjack.ino file and the src directory tree into it.

This way, to install the game in the Arduino IDE one just has to move or copy the Blackjack directory and all its contents into the Arduino sketchbook folder. There will be no concern about copying in unnecessary asset files or having to remove the -master suffix.

(Simon) #13

I might have misunderstood - are the subfolders an issue or simply the -master suffix issue.

I know a lot of people use the Arduino IDE but I cannot understand why. :slight_smile:

(Scott) #14


Sketches containing files (other than the main .ino file) in subfolders will be found and compiled properly when loaded into the Arduino IDE, including your Blackjack game. However, files are accessed by tabs above the IDE editor window. Only files in the root sketch folder will be given a tab. Therefore, files in subfolders can’t be viewed or edited within the IDE.

With Blackjack, as the files are currently arranged, only the Blackjack.ino file can be seen and edited because all other required files are under the src subfolder.

The -master suffix problem can be alleviated, as I said above, by having a subfolder, named the same as the main .ino file but with no extension, in your Git repository containing the file(s) required to compile the sketch.

I use the IDE for compiling and doing minor edits but when doing significant editing I use an external editor. The IDE allows you to use any external editor of your choice simply by setting Use external editor in the preferences.

(Kevin) #15

Oh, I just got nailed by this too. My arduino is looking for files also :frowning: