From 32f7d1a7266cf82f897516173d75a861bd5c037f Mon Sep 17 00:00:00 2001 From: rossywossy Date: Fri, 1 May 2015 15:21:20 -0400 Subject: [PATCH 1/5] Update game.rb Added a check to mark answers wrong if they're just the required output. --- lib/rubies/game.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/rubies/game.rb b/lib/rubies/game.rb index 0bd92f2..581b69b 100644 --- a/lib/rubies/game.rb +++ b/lib/rubies/game.rb @@ -147,8 +147,17 @@ def check_answer(current, input, target) routine = lambda { eval(input) } output = routine.call puts "=> #{output}" - puts - output == target + + # Ensure they don't just paste in the required output + trimmedInput = input.to_s.delete '\'\"' + trimmedTarget = target.to_s.delete '\'\"' + if (trimmedInput != trimmedTarget) then + puts + output == target + else + puts + false + end rescue Exception => e eprinter(e) false From 0c8194821fa9b06d4aa6de027fefe2ebc0fd7143 Mon Sep 17 00:00:00 2001 From: rossywossy Date: Fri, 1 May 2015 15:24:16 -0400 Subject: [PATCH 2/5] Update game.rb Fixing some spacing. --- lib/rubies/game.rb | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/rubies/game.rb b/lib/rubies/game.rb index 581b69b..003f7aa 100644 --- a/lib/rubies/game.rb +++ b/lib/rubies/game.rb @@ -147,17 +147,18 @@ def check_answer(current, input, target) routine = lambda { eval(input) } output = routine.call puts "=> #{output}" - - # Ensure they don't just paste in the required output - trimmedInput = input.to_s.delete '\'\"' - trimmedTarget = target.to_s.delete '\'\"' - if (trimmedInput != trimmedTarget) then - puts - output == target - else - puts - false - end + + # Ensure they don't just paste in the required output + trimmedInput = input.to_s.delete '\'\"' + trimmedTarget = target.to_s.delete '\'\"' + if (trimmedInput != trimmedTarget) then + puts + output == target + else + puts + false + end + rescue Exception => e eprinter(e) false From b476df598a81c4d80bc3f20b1d91aedf980d757c Mon Sep 17 00:00:00 2001 From: rossywossy Date: Fri, 1 May 2015 19:10:48 -0400 Subject: [PATCH 3/5] Update game.rb changed to snake_case, replaced indents with spaces. --- lib/rubies/game.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/rubies/game.rb b/lib/rubies/game.rb index 003f7aa..eaccf5f 100644 --- a/lib/rubies/game.rb +++ b/lib/rubies/game.rb @@ -148,17 +148,17 @@ def check_answer(current, input, target) output = routine.call puts "=> #{output}" - # Ensure they don't just paste in the required output - trimmedInput = input.to_s.delete '\'\"' - trimmedTarget = target.to_s.delete '\'\"' - if (trimmedInput != trimmedTarget) then - puts - output == target - else - puts - false - end - + # Ensure they don't just paste in the required output + trimmed_input = input.to_s.delete '\'\"' + trimmed_target = target.to_s.delete '\'\"' + if (trimmed_input != trimmed_target) + puts + output == target + else + puts + false + end + rescue Exception => e eprinter(e) false From 4884ad4ef265d665e23ba66e4fa22a444527fe7d Mon Sep 17 00:00:00 2001 From: rossywossy Date: Fri, 1 May 2015 19:13:51 -0400 Subject: [PATCH 4/5] Update game.rb removed trailing whitespace --- lib/rubies/game.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rubies/game.rb b/lib/rubies/game.rb index eaccf5f..17d4fa6 100644 --- a/lib/rubies/game.rb +++ b/lib/rubies/game.rb @@ -158,7 +158,6 @@ def check_answer(current, input, target) puts false end - rescue Exception => e eprinter(e) false From 23ef1ebb5275d4ba1744d697531d4b30979ffab1 Mon Sep 17 00:00:00 2001 From: rossywossy Date: Fri, 1 May 2015 19:16:17 -0400 Subject: [PATCH 5/5] Update game.rb Removing trailing whitespace again. --- lib/rubies/game.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rubies/game.rb b/lib/rubies/game.rb index 17d4fa6..59e04ea 100644 --- a/lib/rubies/game.rb +++ b/lib/rubies/game.rb @@ -147,7 +147,6 @@ def check_answer(current, input, target) routine = lambda { eval(input) } output = routine.call puts "=> #{output}" - # Ensure they don't just paste in the required output trimmed_input = input.to_s.delete '\'\"' trimmed_target = target.to_s.delete '\'\"'