Skip to content

Ace-Plays-Blackjack/ace-plays-game

Repository files navigation


Logo

AcePlays

A device that can help you win at Blackjack by indicating the optimal play.

Documentation
Wiki for more information


Contributors Forks Stars MIT License

Twitter Youtube

Demo of our Working Blackjack Decision Maker

Blackjack Decision Maker Demo

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

The AcePlays device helps you learn about the game of Blackjack and win against your friends. By identifying the cards played in real-time, AcePlays can teach the player how to play the game with the optimal strategy, telling them whether to Hit, Stand, Double or Split.

(back to top)

Getting Started

Prerequisites

Installation

  1. Clone this repository on your Pi:
$ git clone https://github.com/Ace-Plays-Blackjack/ace-plays-game.git
  1. Install cmake and gcc compiler:
$ sudo apt install cmake gcc
  1. Install OpenCV. Easiest method is to use the following command, which will install all OpenCV libraries and dependencies:
$ sudo apt install libopencv-dev
  1. Install the libcamera dependencies:
$ sudo apt install libcamera-dev
  1. Install pigpio:
$ wget https://github.com/joan2937/pigpio/archive/master.zip
$ unzip master.zip
$ cd pigpio-master
$ make
$ sudo make install
  1. Install Doxygen and Graphviz:
$ sudo apt-get install doxygen
$ sudo apt install graphviz
  1. Install Google Test:
$ sudo apt-get install libgtest-dev

Usage

The Raspbian Bullseye OS introduced a new camera stack driver called libcamera (follow the link for more information).

OpenCV can find an appropriate driver automatically, however the resolution defaults at the lowest available option. Moreover, OpenCV does not support libcamera at the moment.

The LCCV repo by QEngineering has been used to provide support for the new camera stack. Follow the link for more detailed explanation.

Users have the freedom to select between the OLD or NEW stack. Unfortunately, when using the OLD stack the resolution cannot be changed.

Using the NEW stack

  1. Disable Legacy stack support in Pi configuration. Write the following command in the terminal:
$ sudo raspi-config
  1. Navigate to Interface Options -> Legacy Camera -> No
  2. Reboot to enable the changes
  3. In CMakeLists.txt set the NEW_CAM_STACK option to ON:
option(NEW_CAM_STACK "Select new or old CAM stack: NEW==ON, OLD==OFF" ON)
  1. Build the project

Using the OLD stack

  1. Enable Legacy stack support in Pi configuration. Write the following command in the terminal:
$ sudo raspi-config
  1. Navigate to Interface Options -> Legacy Camera -> Yes
  2. Reboot to enable the changes
  3. In CMakeLists.txt set the NEW_CAM_STACK option to OFF:
option(NEW_CAM_STACK "Select new or old CAM stack: NEW==ON, OLD==OFF" OFF)
  1. OpenCV needs to be pointed to the V4L Linux Driver to access the camera. Ensure that cv::CAP_V4L2 is used in the camera_obj constructor in camera.cpp:
CamSettings.camApi = cv::CAP_V4L2;
  1. Build the project

Running the project

An ~/ace-plays-game/build folder is used to place all built project files from CMake.

Navigate to the cloned AcePlays directory and run the following:

$ mkdir build && cd build
$ cmake .. && make
$ sudo ./ACE_PLAYS

Command $ sudo ./ACE_PLAYS runs the created ACE_PLAYS.exe. pigpio library requires running with sudo privileges.

Creating the Documentation

Navigate to the ace-plays-game main folder and run the following:

$ doxygen

Roadmap

Future work will be to add a new ShowFrame class that output a frame. This would allow more modularity if we wanted to use Qt GUI in the future.

Contributing

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Acknowledgments

We would like to thank the following repositories:

  • EdjeElectronics: AcePlays builds on top of this Python-based card detection repo
  • QEngineering: AcePlays uses the Libcamera C++ API wrapper for OpenCV (LCCV) to support the new Rasp Pi camera stack

(back to top)