MyNixOS website logo
Description

Word Puzzle Game.

The word puzzle game requires you to find out the letters in a word within a limited number of guesses. In each round, if your guess hit any letters in the word, they reveal themselves. If all letters are revealed before your guesses run out, you win this game; otherwise you fail. You may run multiple games to guess different words.

Word Puzzle Game in R

Lifecycle:experimental CRANstatus R-CMD-check Downloadstats

Package: wordPuzzleR 0.1.1
Author: Xiurui Zhu
Modified: 2023-10-02 10:04:07
Compiled: 2024-02-24 18:42:29

Let’s have fun with R! In this word puzzle game, you are required to find out the letters in a word within a limited number of guesses. In each round, if your guess hit any letters in the word, they reveal themselves. If all letters are revealed before your guesses run out, you win this game; otherwise you fail. You may run multiple games to guess different words.

Installation

You can install the released version of wordPuzzleR from CRAN with:

install.packages("wordPuzzleR")

Alternatively, you can install the developmental version of wordPuzzleR from github with:

remotes::install_github("zhuxr11/wordPuzzleR")

Running word puzzle game

First, load the package with library() in R.

library(wordPuzzleR)

Then, you may start the word puzzle game with run_game().

run_game()
#> ========= Welcome to Word Puzzle in R =========
#> Guess: 1
#> Word: ________
#> Input a letter: o
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 2
#> Word: _o______
#> Input a letter: i
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 3
#> Word: _o______
#> Input a letter: e
#> * Your guess hit 2 letter(s) in the word!
#> Guess: 4
#> Word: _o_e_e__
#> Input a letter: g
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 5
#> Word: _o_e_e__
#> Input a letter: t
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 6
#> Word: _o_e_e__
#> Input a letter: d
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 7
#> Word: _o_e_e__
#> Input a letter: b
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 8
#> Word: _o_e_e__
#> Input a letter: l
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 9
#> Word: _o_ele__
#> Input a letter: k
#> * Your guess hit no letters in the word! Better luck next time~
#> Guess: 10
#> Word: _o_ele__
#> Input a letter: x
#> * Your guess hit no letters in the word! Better luck next time~
#> You failed to guess the word! The answer is: homeless
#> Game stats:
#> * Current score: 0/1 (0.00%)
#> Proceed with a new word? [Y/N] N

Alternatively, you can use a different mask letter by specifying mask_char.

run_game(mask_char = "*")
#> ========= Welcome to Word Puzzle in R =========
#> Guess: 1
#> Word: ******
#> Input a letter: e
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 2
#> Word: **e***
#> Input a letter: r
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 3
#> Word: *re***
#> Input a letter: i
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 4
#> Word: *re*i*
#> Input a letter: t
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 5
#> Word: *re*it
#> Input a letter: c
#> * Your guess hit 1 letter(s) in the word!
#> Guess: 6
#> Word: cre*it
#> Input a letter: d
#> * Your guess hit 1 letter(s) in the word!
#> You guessed the word [credit] in 6 guess(es)! Good job!
#> Game stats:
#> * Current score: 1/1 (100.00%)
#> * Best guess: 6
#> * Best hit rate: 6/6 (100.00%)
#> Proceed with a new word? [Y/N] N

Configuring word puzzle game

The word puzzle game can be configured with config_game().

config_game(
  # Set dictionary path
  dict = system.file(file.path("resources", "dict.txt"), package = "wordPuzzleR"),
  # Set word lengths (min/max)
  min_len = 3L,
  max_len = 8L,
  # Set maximal guesses
  guess = 10L,
  # Set word pattern (regular expression)
  pattern = "[A-Za-z]+"
)
#> wordPuzzleR config:
#> * dict: F:/Projects/Packages/wordPuzzleR/inst/resources/dict.txt
#> * min_len: 3
#> * max_len: 8
#> * guess: 10
#> * pattern: [A-Za-z]+
#> Loaded 2400 word(s) from dict
Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows