Change to spaces.
This commit is contained in:
parent
ec71fb198a
commit
1433048512
1 changed files with 53 additions and 53 deletions
|
@ -8,17 +8,17 @@ The directory *must* contain a `problem.json`; this information will be loaded i
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"pid": "survey", // required
|
"pid": "survey", // required
|
||||||
"title": "Survey", // required
|
"title": "Survey", // required
|
||||||
"description": "Take our survey.", // required - can use HTML
|
"description": "Take our survey.", // required - can use HTML
|
||||||
"hint": "No hint!", // optional - defaults to ""
|
"hint": "No hint!", // optional - defaults to ""
|
||||||
"category": "Miscellaneous", // required
|
"category": "Miscellaneous", // required
|
||||||
"autogen": false, // optional - defaults to false
|
"autogen": false, // optional - defaults to false
|
||||||
"programming": false, // optional - defaults to false
|
"programming": false, // optional - defaults to false
|
||||||
"value": 20, // required - integer out of 800
|
"value": 20, // required - integer out of 800
|
||||||
"bonus": 0, // optional - defaults to 0; see below for details
|
"bonus": 0, // optional - defaults to 0; see below for details
|
||||||
"threshold": 0, // recommended - defaults to 0; see below for details
|
"threshold": 0, // recommended - defaults to 0; see below for details
|
||||||
"weightmap": { } // recommended - defaults to {}
|
"weightmap": { } // recommended - defaults to {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ The directory must *also* contain a `grader.py`; this script must contain a `gra
|
||||||
|
|
||||||
```python
|
```python
|
||||||
{
|
{
|
||||||
"correct": True # or False, indicating whether the answer is correct.
|
"correct": True # or False, indicating whether the answer is correct.
|
||||||
"message": "Congratulations!" # a custom message for feedback on the website.
|
"message": "Congratulations!" # a custom message for feedback on the website.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ For the most part, checking in flags will simply be a matter of comparing string
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def grade(tid, answer):
|
def grade(tid, answer):
|
||||||
if answer.find("csrf_protection_would_probably_have_been_a_good_idea_:/") != -1:
|
if answer.find("csrf_protection_would_probably_have_been_a_good_idea_:/") != -1:
|
||||||
return { "correct": True, "message": "Indeed." }
|
return { "correct": True, "message": "Indeed." }
|
||||||
return { "correct": False, "message": "Nope, that's not quite right." }
|
return { "correct": False, "message": "Nope, that's not quite right." }
|
||||||
```
|
```
|
||||||
|
|
||||||
You can copy-paste the above example into your grader and make any necessary adjustments. If you were wondering why we don't just compare strings, some problems may warrant a more complicated grader, like the problem H4SH3D from last year:
|
You can copy-paste the above example into your grader and make any necessary adjustments. If you were wondering why we don't just compare strings, some problems may warrant a more complicated grader, like the problem H4SH3D from last year:
|
||||||
|
@ -48,31 +48,31 @@ You can copy-paste the above example into your grader and make any necessary adj
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
def compute(uinput):
|
def compute(uinput):
|
||||||
if len(uinput) > 32: return ""
|
if len(uinput) > 32: return ""
|
||||||
blen = 32
|
blen = 32
|
||||||
n = blen - len(uinput) % blen
|
n = blen - len(uinput) % blen
|
||||||
if n == 0:
|
if n == 0:
|
||||||
n = blen
|
n = blen
|
||||||
pad = chr(n)
|
pad = chr(n)
|
||||||
ninput = uinput + pad * n
|
ninput = uinput + pad * n
|
||||||
r = ""
|
r = ""
|
||||||
for i in range(0, blen, 4):
|
for i in range(0, blen, 4):
|
||||||
s = ninput[i:i+4]
|
s = ninput[i:i+4]
|
||||||
h = 0
|
h = 0
|
||||||
for j in range(len(s)):
|
for j in range(len(s)):
|
||||||
h = (h << 4) + ord(s[j])
|
h = (h << 4) + ord(s[j])
|
||||||
g = h & 4026531840
|
g = h & 4026531840
|
||||||
if not(g == 0):
|
if not(g == 0):
|
||||||
h ^= g >> 24
|
h ^= g >> 24
|
||||||
h &= ~g
|
h &= ~g
|
||||||
r += chr(h % 256)
|
r += chr(h % 256)
|
||||||
h = binascii.hexlify(bytes(r, 'Latin-1'))
|
h = binascii.hexlify(bytes(r, 'Latin-1'))
|
||||||
return h
|
return h
|
||||||
|
|
||||||
def grade(tid, answer):
|
def grade(tid, answer):
|
||||||
if compute(answer) == compute("they_see_me_hashin_they_hatin"):
|
if compute(answer) == compute("they_see_me_hashin_they_hatin"):
|
||||||
return { "correct": True, "message": "They see me hashin' they hatin'" }
|
return { "correct": True, "message": "They see me hashin' they hatin'" }
|
||||||
return { "correct": False, "message": "Nope." }
|
return { "correct": False, "message": "Nope." }
|
||||||
```
|
```
|
||||||
|
|
||||||
## `static`
|
## `static`
|
||||||
|
@ -106,20 +106,20 @@ Problem unlocking is managed through a mechanism that involves a threshold and w
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"pid": "launch-code",
|
"pid": "launch-code",
|
||||||
"threshold": 5,
|
"threshold": 5,
|
||||||
"weightmap": {
|
"weightmap": {
|
||||||
"php3": 1,
|
"php3": 1,
|
||||||
"faster-math": 1,
|
"faster-math": 1,
|
||||||
"biggerisbetter": 1,
|
"biggerisbetter": 1,
|
||||||
"cave-johnson": 1,
|
"cave-johnson": 1,
|
||||||
"blackmesa": 1,
|
"blackmesa": 1,
|
||||||
"rsa3": 1,
|
"rsa3": 1,
|
||||||
"yandere": 1,
|
"yandere": 1,
|
||||||
"rsi": 1,
|
"rsi": 1,
|
||||||
"adoughbee": 1,
|
"adoughbee": 1,
|
||||||
"infinity_star": 1
|
"infinity_star": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue