Nothing
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----eval=FALSE---------------------------------------------------------------
# clear()
# hide_cursor()
## ----eval=FALSE---------------------------------------------------------------
# dimensions <- term_dim()
# box_at(yx=c(1,1), dim=dimensions, fill=" ", fill.bg="blue")
## ----eval=FALSE---------------------------------------------------------------
# text <- "Find Your LUCKY NUMBER!"
# yx <- c(3, floor((dimensions[2] - nchar(text))/2))
# wrat(yx, text)
## ----eval=FALSE---------------------------------------------------------------
# bg_on("blue")
# fg_on("white")
## ----eval=FALSE---------------------------------------------------------------
# wrat(c(5,3), "What is your favorite letter? ")
# lett <- getkp(echo=TRUE)
#
# wrat(c(7,3), "What is your favorite number? ")
# numb <- getkp(echo=TRUE)
## ----eval=FALSE---------------------------------------------------------------
# result <- which(letters == tolower(lett))*as.integer(numb)+sample(-10:10, 1)
# wrat(c(9,3), "Your lucky number is ...")
# wrat(c(10,10), result, fg = "red", attr="bf")
## ----eval=FALSE---------------------------------------------------------------
# wrat(c(14,3), "Press ANY Key to Quit.")
# getkp()
## ----eval=FALSE---------------------------------------------------------------
# wrapup()
## -----------------------------------------------------------------------------
example_luckynumber <- function(){
clear()
hide_cursor()
dimensions <- term_dim()
box_at(yx=c(1,1), dim=dimensions, fill=" ", fill.bg="blue")
text <- "Find Your LUCKY NUMBER!"
yx <- c(3, floor((dimensions[2] - nchar(text))/2))
wrat(yx, text)
bg_on("blue")
fg_on("white")
wrat(c(5,3), "What is your favorite letter? ")
lett <- getkp(echo=TRUE)
wrat(c(7,3), "What is your favorite number? ")
numb <- getkp(echo=TRUE)
result <- which(letters == tolower(lett))*as.integer(numb)+sample(-10:10, 1)
wrat(c(9,3), "Your lucky number is ...")
wrat(c(10,10), result, fg = "red", attr="bf")
wrat(c(14,3), "Press ANY Key to Quit.")
getkp()
wrapup()
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.