write-ups-challenges-2021-2022/restrictive-racket/challenges.rkt

46 lines
1.7 KiB
Racket
Raw Permalink Normal View History

2021-12-02 23:33:26 +00:00
#lang racket
(require "challenge.rkt")
(provide challenges)
;This file contains the challenges of the platform
;Make sure the id's are incremental, starting from 0 and correspond to the challenges displayed on the platform
;VERY IMPORTANT: NEVER ALLOW STATE! If state is allowed e.g. through set! it can be abused to simply hardcode the output
;I also recommend making the first challenge a sanity check for instance by having the input and output be the same
(define variable-names
'(a b c d e f g h i j k l m n o p q r s t u v w x y z))
(define challenges
(list
(make-challenge
0
"This challenge is the sanity check! Try writing a lambda that maps the inputs to the outputs."
"IGCTF{CongratulationsYouAreSane!}"
(list 1 2 3 4 5 6 7 8 9 10)
(list 2 3 4 5 6 7 8 9 10 11)
`(,@(take variable-names 1) + lambda))
(make-challenge
1
"In this challenge you have to determine if a given number is even."
"IGCTF{FunThingsAreFun}"
(list 6 3 4 9 1 2 4 500 321 1337)
(list #t #f #t #f #f #t #t #t #f #f)
`(,@(take variable-names 5) define lambda begin if + - =))
(make-challenge
2
"Same as the previous one, but you don't get to use an if."
"IGCTF{ICantThinkOfGoodFlags}"
(list 6 3 4 9 1 2 4 500 321 1337)
(list #t #f #t #f #f #t #t #t #f #f)
`(,@(take variable-names 5) define lambda begin or not and + - =))
(make-challenge
3
"Fine, you can have your if back. But i'm taking away your precious define and begin!"
"IGCTF{LambdasArePrettyAwesome}"
(list 6 3 4 9 1 2 4 500 321 1337)
(list #t #f #t #f #f #t #t #t #f #f)
`(,@(take variable-names 5) lambda if + - =))))