From 73c78ce453f68374e1c952c3a2ec86b5c2c9687d Mon Sep 17 00:00:00 2001 From: Brandon John Date: Mon, 13 Mar 2017 18:09:28 -0500 Subject: [PATCH] Implemented fizzbuzz graders, updated values --- fizz-buzz-1/generator.py | 7 +++++++ fizz-buzz-1/grader.py | 19 +++++++++---------- fizz-buzz-1/problem.yml | 10 ++++++++-- fizz-buzz-1/todo.txt | 1 - fizz-buzz-2/generator.py | 17 +++++++++++++++++ fizz-buzz-2/grader.py | 15 +++++++++++---- fizz-buzz-2/problem.yml | 10 ++++++++-- fizz-buzz-2/todo.txt | 6 ------ 8 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 fizz-buzz-1/generator.py delete mode 100644 fizz-buzz-1/todo.txt create mode 100644 fizz-buzz-2/generator.py diff --git a/fizz-buzz-1/generator.py b/fizz-buzz-1/generator.py new file mode 100644 index 0000000..7cca1ed --- /dev/null +++ b/fizz-buzz-1/generator.py @@ -0,0 +1,7 @@ +test_case = raw_input() +if test_case == "1": + print "42" +if test_case == "2": + print "97" +if test_case == "3": + print "128" \ No newline at end of file diff --git a/fizz-buzz-1/grader.py b/fizz-buzz-1/grader.py index 4233db8..6b96ba8 100644 --- a/fizz-buzz-1/grader.py +++ b/fizz-buzz-1/grader.py @@ -1,12 +1,11 @@ -n = input() +n = int(raw_input()) for i in range(1, n + 1): - if i % 3 == 0 and i % 5 == 0: - print 'FizzBuzz' - elif i % 3 == 0: - print 'Fizz' - elif i % 5 == 0: - print 'Buzz' - else: - print i - + if i % 3 == 0 and i % 5 == 0: + print 'FizzBuzz' + elif i % 3 == 0: + print 'Fizz' + elif i % 5 == 0: + print 'Buzz' + else: + print i \ No newline at end of file diff --git a/fizz-buzz-1/problem.yml b/fizz-buzz-1/problem.yml index 8b7da3e..c7f2b91 100644 --- a/fizz-buzz-1/problem.yml +++ b/fizz-buzz-1/problem.yml @@ -1,5 +1,11 @@ title: Fizz Buzz 1 category: Programming -value: 30 +value: 50 author: wiresboy -autogen: false \ No newline at end of file +autogen: false +programming: true + +grader_language: python +test_cases: 3 +time_limit: 500 +memory_limit: 256000 \ No newline at end of file diff --git a/fizz-buzz-1/todo.txt b/fizz-buzz-1/todo.txt deleted file mode 100644 index 8a61e42..0000000 --- a/fizz-buzz-1/todo.txt +++ /dev/null @@ -1 +0,0 @@ -I still need to do the graders. \ No newline at end of file diff --git a/fizz-buzz-2/generator.py b/fizz-buzz-2/generator.py new file mode 100644 index 0000000..ccbbb4a --- /dev/null +++ b/fizz-buzz-2/generator.py @@ -0,0 +1,17 @@ +test_case = raw_input() +if test_case == "1": + print "27" +if test_case == "2": + print "31" +if test_case == "3": + print "42" +if test_case == "4": + print "72" +if test_case == "5": + print "81" +if test_case == "6": + print "99" +if test_case == "7": + print "128" +if test_case == "8": + print "141" \ No newline at end of file diff --git a/fizz-buzz-2/grader.py b/fizz-buzz-2/grader.py index d5a341a..94f4a39 100644 --- a/fizz-buzz-2/grader.py +++ b/fizz-buzz-2/grader.py @@ -1,4 +1,11 @@ -def grade(random, key): - if key.find("PUT A NEW KEY HERE!!!!") != -1: - return True, "Correct!" - return False, "Nope." \ No newline at end of file +n = int(raw_input()) + +for i in range(1, n + 1): + if i % 3 == 0 and i % 5 == 0: + print 'FizzBuzz' + elif i % 3 == 0: + print 'Fizz' + elif i % 5 == 0: + print 'Buzz' + else: + print i diff --git a/fizz-buzz-2/problem.yml b/fizz-buzz-2/problem.yml index aae317d..97743f9 100644 --- a/fizz-buzz-2/problem.yml +++ b/fizz-buzz-2/problem.yml @@ -1,6 +1,12 @@ title: Fzz Buzz 2 category: Programming -value: 200 +value: 350 hint: Have fun! author: wresboy -autogen: false \ No newline at end of file +autogen: false +programming: true + +grader_language: python +test_cases: 8 +time_limit: 1000 +memory_limit: 256000 \ No newline at end of file diff --git a/fizz-buzz-2/todo.txt b/fizz-buzz-2/todo.txt index cce9b1e..34116a4 100644 --- a/fizz-buzz-2/todo.txt +++ b/fizz-buzz-2/todo.txt @@ -1,7 +1 @@ -I still need to do the execution grader, and probably introduce some sort of limits to prevent the contestant from having a print "1,2,fizz,4,buzz..." type program. A length limit would probably be sufficient. - -I also need to add a program validator, that checks for the characters "i", "I", and "?". - -We will need to disable "eval()", "exec()", globals (in python), etc. - Backup hint: `Don't use the characters "i", "I", and "?".` \ No newline at end of file