3 unstable releases

0.2.1 May 26, 2025
0.2.0 Apr 17, 2024
0.1.0 Dec 5, 2023

#73 in Games

AGPL-3.0-or-later

82KB
2K SLoC

casino

status-badge Crates.io Crates.io Total Downloads

An entire casino built into your terminal. Bet with fake money and play blackjack, slots, roulette, and craps from the comfort of your shell.

Installation

Install using cargo:

$ cargo install casino

Usage

Run casino for a selection of games, or casino <game> to start a specific game. You can run casino --help for a list of games and other options.

$ casino blackjack
Your money: $1000.00
> How much will you bet? 100
Betting $100.00
* The dealer issues your cards.
Dealer's hand: 🂠 🃂
Your hand: 🃔 🂺  (14)
> What will you do? Stand
* Hole card revealed!
Dealer's hand: 🂻 🃂  (12)
* The dealer issues themself another card.
Dealer's hand: 🂻 🃂 🃕  (17)
* The hand is finished!
HOUSE WINS! You lose $100.00. You now have $900.00

You start with $1000.00, and if you ever hit $0.00, you are gifted another $1000.00. This balance is persisted to your XDG data directory, along with the state of the deck of cards you're playing with. You can modify this file if you want to break my heart and cheat at this innocent little terminal game.

Check your wallet balance with casino balance:

$ casino balance
$1000.00

You can view your lifetime stats with casino stats:

$ casino stats
Most money in the bank.........$1109.00
Times hit bankruptcy..................0

Blackjack
  Hands won.............................1
  Hands lost............................0
  Hands tied............................0
  Total money won.................$100.00
  Total money lost..................$0.00
  Biggest win.....................$100.00
  Biggest loss......................$0.00

Roulette
  Spins won.............................1
  Spins lost............................0
  Total money won.................$100.00
  Total money lost..................$0.00
  Biggest win.....................$100.00
  Biggest loss......................$0.00

Slots
  Total pulls...........................5
  Total money spent................$71.00
  Total money won..................$40.00
  Biggest jackpot..................$40.00

Run casino --help for full usage instructions and documentation.

Files

This program creates a few files, and respects the XDG Base Directory specification so as not to clutter up your home folder.

  • ~/.config/casino/config.toml - general app and game configuration
  • ~/.local/share/casino/state.toml - your current wallet balance and the state of the deck
  • ~/.local/share/casino/stats.toml - where statistics are collected for casino stats

License

© 2025 Rosa Richter

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Dependencies

~10–25MB
~323K SLoC