Skip to content

💾🎲 R package: a game with a system for saving high scores persistently

License

Unknown, MIT licenses found

Licenses found

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

matt-dray/hiscore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hiscore

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

Work in progress proof of concept: an R package with a system for saving high scores persistently.

You can install from GitHub.

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

The simplest possible game is included for demonstration purposes. Try to guess as many coinflips in a row as possible.

play_coinflip()
[H]eads or [T]ails? Answer: H
Correct! Current score: 1
[H]eads or [T]ails? Answer: H
Incorrect! Final score: 1
New high score!
New high score saved.

You can then retrieve your current high score, which is saved to your machine at the location given by tools::R_user_dir(). The data persists even if you restart your session.

hiscore::get_save_data()
      game high_score
1 coinflip          1

You can retry to try and beat your score.

play_coinflip()
Welcome. Your current high score is 1
[H]eads or [T]ails? Answer: h
Correct! Current score: 1
[H]eads or [T]ails? Answer: t
Correct! Current score: 2
[H]eads or [T]ails? Answer: h
Incorrect! Final score: 2
New high score!
New high score saved.

And let's check that high score again.

hiscore::get_save_data()
      game high_score
1 coinflip          2

You can delete the saved game data.

hiscore::delete_save_data()
Really delete? [Y]es/[N]o: Y
High score data deleted.`

About

💾🎲 R package: a game with a system for saving high scores persistently

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Languages