Implemented fizzbuzz graders, updated values

This commit is contained in:
Brandon John 2017-03-13 18:09:28 -05:00
parent 6a6820ed63
commit 73c78ce453
8 changed files with 60 additions and 25 deletions

7
fizz-buzz-1/generator.py Normal file
View file

@ -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"

View file

@ -1,4 +1,4 @@
n = input() n = int(raw_input())
for i in range(1, n + 1): for i in range(1, n + 1):
if i % 3 == 0 and i % 5 == 0: if i % 3 == 0 and i % 5 == 0:
@ -9,4 +9,3 @@ for i in range(1, n + 1):
print 'Buzz' print 'Buzz'
else: else:
print i print i

View file

@ -1,5 +1,11 @@
title: Fizz Buzz 1 title: Fizz Buzz 1
category: Programming category: Programming
value: 30 value: 50
author: wiresboy author: wiresboy
autogen: false autogen: false
programming: true
grader_language: python
test_cases: 3
time_limit: 500
memory_limit: 256000

View file

@ -1 +0,0 @@
I still need to do the graders.

17
fizz-buzz-2/generator.py Normal file
View file

@ -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"

View file

@ -1,4 +1,11 @@
def grade(random, key): n = int(raw_input())
if key.find("PUT A NEW KEY HERE!!!!") != -1:
return True, "Correct!" for i in range(1, n + 1):
return False, "Nope." 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

View file

@ -1,6 +1,12 @@
title: Fzz Buzz 2 title: Fzz Buzz 2
category: Programming category: Programming
value: 200 value: 350
hint: Have fun! hint: Have fun!
author: wresboy author: wresboy
autogen: false autogen: false
programming: true
grader_language: python
test_cases: 8
time_limit: 1000
memory_limit: 256000

View file

@ -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 "?".` Backup hint: `Don't use the characters "i", "I", and "?".`