Skip to content

🐿️🌰 R package: a squirrel game in your R console, made with {R6}

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

matt-dray/ActionSquirrel

Repository files navigation

ActionSquirrel

Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. Blog post

{ActionSquirrel} is an R package containing an interactive audio-visual experience (‘game’) in the R console, powered by {R6}.

You play as the titular Action Squirrel. Move around the forest and collect at least eight nuts to survive winter, which happens after 30 turns. Avoid being eaten by the owl.

Read more in the accompanying blog post.

How to play

Install

The package is available from GitHub.

install.packages("remotes")  # if not installed already
remotes::install_github("matt-dray/ActionSquirrel")

Note that I’ve developed and tested this only in RStudio v1.4.1717 with R v4.1.0 running on macOS Big Sur.

Attach the package for instructions.

library(ActionSquirrel)
# Welcome to {ActionSquirrel}!
# * New game: x <- ActionSquirrel$new()
# * Move:     e.g. x$move('up')
# * Info:     x$pause()

Start

Initiate by assigning ActionSquirrel$new() to a name. This clears the console and generates a forest that contains Action Squirrel. And a delicious nut. And a scary owl!

x <- ActionSquirrel$new()
# 🌳 🌳 🌳 🌳 🌳 
# 🌳 🌳 🌰 🌳 🌳 
# 🌳 🌳 🌳 🐿 🌳 
# 🌳 🦉 🌳 🌳 🌳 
# 🌳 🌳 🌳 🌳 🌳 
# Moves: 0 
# Nuts: 0

Note: Action Squirrel nor the nut nor the owl are as big as a tree. It’s just perspective.

Move

You control Action Squirrel. Use the move() method to move through the forest and grab the nuts, avoiding the owl.

x$move("up")
# 🌳 🌳 🌳 🌳 🌳 
# 🌳 🌳 🌰 🐿️ 🌳 
# 🌳 🦉 🌳 🌳 🌳 
# 🌳 🌳 🌳 🌳 🌳 
# 🌳 🌳 🌳 🌳 🌳 
# Moves: 1 
# Nuts: 0

Congratulations, your move tally has increased by one. Winter arrives after 30 turns and the game will end.

To the nut!

x$move("left")
# 🌳 🌳 🌳 🌳 🌳 
# 🌳 🌳 🐿️ 🌳 🌳 
# 🌳 🦉 🌳 🌳 🌳 
# 🌰 🌳 🌳 🌳 🌳 
# 🌳 🌳 🌳 🌳 🌳 
# Moves: 2 
# Nuts: 1

Congratulations, your nut tally has increased by one. And there’s a new nut! Collect at least eight, or you won’t survive winter.

Advanced tech: you only need the first letter of the direction, like x$move("r") for right, and you can chain moves together like x$move("r")$move("d") to go right then down.

I’ll leave it to the player to discover the consequences of being eaten, the endscreens and the sound effects.

Thanks

Inspired in part by Tomaz’s ‘Little Useless-Useful R Functions’.

Thanks to Winston Chang for the {R6} package, and Stefan Siegert and Robin Williams for {sonify}.

Similar projects

I’ve done some other silly things with {R6}. You can:

Code of Conduct

Add bugs or ideas to the issues.

Please note that the {ActionSquirrel} project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

About

🐿️🌰 R package: a squirrel game in your R console, made with {R6}

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Languages