Skip to content

Commit

Permalink
allow user to make feedback less playful
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarchedi committed Jul 24, 2014
1 parent f2b0a04 commit b23bb6d
Showing 1 changed file with 47 additions and 35 deletions.
82 changes: 47 additions & 35 deletions R/phrases.R
Original file line number Diff line number Diff line change
@@ -1,44 +1,56 @@
# Return random praise.
praise <- function() {
phrases <- c("You got it!",
"Nice work!",
"Keep up the great work!",
"You are doing so well!",
"All that hard work is paying off!",
"You nailed it! Good job!",
"You're the best!",
"You are amazing!",
"Keep working like that and you'll get there!",
"Perseverance, that's the answer.",
"Great job!",
"You are quite good my friend!",
"You're dedication is inspiring!",
"You got it right!",
"That's correct!",
"You are really on a roll!",
"Excellent job!",
"All that practice is paying off!",
"Excellent work!",
"That's a job well done!",
"That's the answer I was looking for.")
swirl_is_fun <- getOption("swirl_is_fun")

if(is.null(swirl_is_fun) || isTRUE(swirl_is_fun)) {
phrases <- c("You got it!",
"Nice work!",
"Keep up the great work!",
"You are doing so well!",
"All that hard work is paying off!",
"You nailed it! Good job!",
"You're the best!",
"You are amazing!",
"Keep working like that and you'll get there!",
"Perseverance, that's the answer.",
"Great job!",
"You are quite good my friend!",
"You're dedication is inspiring!",
"You got it right!",
"That's correct!",
"You are really on a roll!",
"Excellent job!",
"All that practice is paying off!",
"Excellent work!",
"That's a job well done!",
"That's the answer I was looking for.")
} else {
phrases <- "Correct!"
}
sample(phrases, 1)
}

# Return random "try again" message.
tryAgain <- function() {
phrases <- c("Almost! Try again.",
"You almost had it, but not quite. Try again.",
"Give it another try.",
"Not quite! Try again.",
"Not exactly. Give it another go.",
"That's not exactly what I'm looking for. Try again.",
"Nice try, but that's not exactly what I was hoping for. Try again.",
"Keep trying!",
"That's not the answer I was looking for, but try again.",
"Not quite right, but keep trying.",
"You're close...I can feel it! Try it again.",
"One more time. You can do it!",
"Not quite, but you're learning! Try again.",
"Try again. Getting it right on the first try is boring anyway!")
swirl_is_fun <- getOption("swirl_is_fun")

if(is.null(swirl_is_fun) || isTRUE(swirl_is_fun)) {
phrases <- c("Almost! Try again.",
"You almost had it, but not quite. Try again.",
"Give it another try.",
"Not quite! Try again.",
"Not exactly. Give it another go.",
"That's not exactly what I'm looking for. Try again.",
"Nice try, but that's not exactly what I was hoping for. Try again.",
"Keep trying!",
"That's not the answer I was looking for, but try again.",
"Not quite right, but keep trying.",
"You're close...I can feel it! Try it again.",
"One more time. You can do it!",
"Not quite, but you're learning! Try again.",
"Try again. Getting it right on the first try is boring anyway!")
} else {
phrases <- "Incorrect. Please try again."
}
sample(phrases, 1)
}

0 comments on commit b23bb6d

Please sign in to comment.