Max Weylandt.

← Back

gameRoom: some turn-based games for the R console

8 January, 2024

I got covid at the end of the year, and forced myself not to work for the duration in order to speed up recovery. But I got so bored and wondered whether I could code up a game in R. Hence gameRoom, a small package for games that you can play without leaving your R session.1

Installation is simple:

 devtools::install_github("mweylandt/gameRoom")

And then you can simply play. Currently the package offers three games: tic tac toe, hangman, and blackjack.

I like blackjack the most, partially because it’s to my knowledge the first blackjack in R (though I’m probably wrong! And it’s a basic version of the game with no splits, insurance, or other fun things. Maybe one day.)

It looks something like this:

 
library(gameRoom)
play("blackjack")

> _     _            _     _            _
> | |__ | | __ _  ___| | __(_) __ _  ___| | __
> | '_ \| |/ _` |/ __| |/ /| |/ _` |/ __| |/ /
> | |_) | | (_| | (__|   < | | (_| | (__|   <
> |_.__/|_|\__,_|\___|_|\_\/ |\__,_|\___|_|\_\
>                       |__/
>
> DEALER
>
>  _______   _______
> |♣     ♣| |xxxxxxx|
> |       | |xxxxxxx|
> |   3   | |xxxxxxx|
> |       | |xxxxxxx|
> |♣     ♣| |xxxxxxx|
> |_______| |_______|
> Total: 3
> -----------------------------------------------
> Total Money: $100
> Current Bet: $
> -----------------------------------------------
> Total: 19 (19)
>  _______   _______
> |♣     ♣| |♦     ♦|
> |       | |       |
> |   9   | |   K   |
> |       | |       |
> |♣     ♣| |♦     ♦|
> |_______| |_______|
>
> PLAYER
> Place a bet:

If you try it out, I hope it’s fun! And please let me know if anything doesn’t work as expected :)


  1. For more R games, see this list↩︎


← Back ↑ Top