A device that can help you win at Blackjack by indicating the optimal play.
Documentation
Wiki
for more information
Table of Contents
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.
- The AcePlays code has been developed using a Raspberry Pi 3B. However, any model shoud work.
- Installation of the Raspbian Bullseye Raspberry Pi OS.
- A working Raspberry Pi Camera (Module V2 has been used for development). Follow https://projects.raspberrypi.org/en/projects/getting-started-with-picamera/0 for first-usage instructions.
- Clone this repository on your Pi:
$ git clone https://github.com/Ace-Plays-Blackjack/ace-plays-game.git
- Install
cmake
andgcc
compiler:
$ sudo apt install cmake gcc
- Install OpenCV. Easiest method is to use the following command, which will install all OpenCV libraries and dependencies:
$ sudo apt install libopencv-dev
- Install the
libcamera
dependencies:
$ sudo apt install libcamera-dev
- Install pigpio:
$ wget https://github.com/joan2937/pigpio/archive/master.zip
$ unzip master.zip
$ cd pigpio-master
$ make
$ sudo make install
- Install Doxygen and Graphviz:
$ sudo apt-get install doxygen
$ sudo apt install graphviz
- Install Google Test:
$ sudo apt-get install libgtest-dev
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.
- Disable Legacy stack support in Pi configuration. Write the following command in the terminal:
$ sudo raspi-config
- Navigate to
Interface Options
->Legacy Camera
->No
- Reboot to enable the changes
- In
CMakeLists.txt
set theNEW_CAM_STACK
option toON
:
option(NEW_CAM_STACK "Select new or old CAM stack: NEW==ON, OLD==OFF" ON)
- Build the project
- Enable Legacy stack support in Pi configuration. Write the following command in the terminal:
$ sudo raspi-config
- Navigate to
Interface Options
->Legacy Camera
->Yes
- Reboot to enable the changes
- In
CMakeLists.txt
set theNEW_CAM_STACK
option toOFF
:
option(NEW_CAM_STACK "Select new or old CAM stack: NEW==ON, OLD==OFF" OFF)
- OpenCV needs to be pointed to the V4L Linux Driver to access the camera. Ensure that
cv::CAP_V4L2
is used in thecamera_obj
constructor incamera.cpp
:
CamSettings.camApi = cv::CAP_V4L2;
- Build 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.
Navigate to the ace-plays-game main folder and run the following:
$ doxygen
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.
Distributed under the MIT
License. See LICENSE
for more information.
- Georgios Titas --> giorgostitas@gmail.com
- Alexander Douglas --> lex4ander@gmail.com
- Jijo Neeruvilayil Varghese --> jijon92@gmail.com
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