add more levels

This commit is contained in:
Crispy 2024-12-24 22:43:21 +01:00
parent 48082cf098
commit 03193825a8
4 changed files with 75 additions and 10 deletions

View file

@ -52,22 +52,23 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
## levels ## levels
### intro, basic mechanics ### intro, basic mechanics
- output a zero (marble, io) - output a zero (marble, output)
- output multiple numbers in sequence (digits) - output multiple numbers in sequence (digits)
- output zeroes forever (looping, button, silo output) - output zeroes forever (looping/arrows, button, silo output)
- copy the input (input) - copy the input (input)
- copy only odd input numbers (comparator, math, flipper) - increment every number (math tiles)
- copy only odd input numbers (comparator, flipper)
### 0-terminated list processing ### 0-terminated list processing
- copy the second list - copy the second list
- calculate list length (math, silo input) - calculate list length (math, silo input)
- count instances of 5 in a list - count instances of 5 in a list
- reverse a list (bouncing) - reverse a list (bouncing)
### user-friendly numbers ### text
- convert text to lowercase
- convert a number to decimal ascii - convert a number to decimal ascii
- parse an ascii number - parse an ascii number
- convert text to lowercase
### advanced list processing ### advanced list processing
- index a list - index a list
- search a list - reverse and return the first n elements of a list, with n given first
- add two lists element-wise - add two lists element-wise
- sort list - sort a list

View file

@ -45,9 +45,20 @@
"output": "there really isn't much point to more than 2 stages, but here we are" "output": "there really isn't much point to more than 2 stages, but here we are"
}] }]
}, },
{
"id": "increment_input",
"name": "Incrementer",
"description": "Add one to each input number",
"stages": [{
"input": [93, 47, 71],
"output": [94, 48, 72]
},{
"input": [44, 127, 130, 211, 153, 156, 36, 196, 236, 236, 23, 56, 103, 205, 12, 49, 6, 41, 130, 59, 38, 11, 23, 212],
"output": [45, 128, 131, 212, 154, 157, 37, 197, 237, 237, 24, 57, 104, 206, 13, 50, 7, 42, 131, 60, 39, 12, 24, 213]
}]
},
{ {
"id": "copy_odd", "id": "copy_odd",
"sort_order": 15,
"name": "Odd Cat", "name": "Odd Cat",
"description": "copy only the odd numbers from the input", "description": "copy only the odd numbers from the input",
"stages": [{ "stages": [{

View file

@ -4,7 +4,7 @@
{ {
"id": "null_separation", "id": "null_separation",
"name": "Null Separation", "name": "Null Separation",
"description": "output everything after the first zero in the input data", "description": "output everything after the first zero",
"stages": [{ "stages": [{
"input": "9834726\u0000Hello, worlg!", "input": "9834726\u0000Hello, worlg!",
"output": "Hello, worlg!" "output": "Hello, worlg!"
@ -40,7 +40,7 @@
{ {
"id": "reverse_input", "id": "reverse_input",
"name": "Reverse", "name": "Reverse",
"description": "read input until zero and output the same thing in reverse", "description": "read input until the zero and output the same thing in reverse",
"stages": [{ "stages": [{
"input": "woem\u0000", "input": "woem\u0000",
"output": "meow" "output": "meow"

53
levels/chapter_04.json Normal file
View file

@ -0,0 +1,53 @@
{
"title": "4. Advanced lists",
"levels": [
{
"id": "list_index",
"name": "List indexing",
"description": "The input is a list numbers, terminated by zero, followed by an index. Output the element at that index.",
"stages": [{
"input": [6, 4, 8, 1, 0, 2],
"output": [8]
},{
"input": [208, 143, 138, 228, 251, 158, 147, 134, 93, 43, 45, 115, 135, 123, 48, 153, 110, 187, 94, 97, 120, 80, 215, 217, 0, 17],
"output": [187]
}]
},
{
"id": "list_reverse_subset",
"name": "Reverse list 2",
"description": "The input is a length, followed by a list of numbers. Read only as many items as the length, then output it in reverse",
"stages": [{
"input": [4, 3, 1, 7, 9, 10, 8, 6, 3],
"output": [9, 7, 1, 3]
},{
"input": [19, 91, 103, 155, 2, 91, 222, 19, 147, 211, 52, 3, 12, 221, 59, 174, 122, 222, 100, 204, 207, 96, 5, 156, 62],
"output": [204, 100, 222, 122, 174, 59, 221, 12, 3, 52, 211, 147, 19, 222, 91, 2, 155, 103, 91]
}]
},
{
"id": "add_lists",
"name": "Add lists",
"description": "The input is two zero-terminated lists with the same length, add them together element by element",
"stages": [{
"input": [3, 6, 5, 1, 8, 0, 2, 3, 7, 1, 8, 0],
"output": [5, 9, 12, 2, 16]
},{
"input": [17, 84, 57, 54, 91, 44, 22, 96, 29, 119, 110, 14, 85, 36, 55, 50, 0, 116, 110, 76, 19, 14, 111, 51, 107, 32, 51, 117, 126, 95, 117, 109, 47, 0],
"output": [133, 194, 133, 73, 105, 155, 73, 203, 61, 170, 227, 140, 180, 153, 164, 97]
}]
},
{
"id": "sort_list",
"name": "Sorting",
"description": "Sort the input list. It is not zero-terminated and the length is not known upfront.\nGood luck <3",
"stages": [{
"input": [9, 8, 3, 2, 7],
"output": [2, 3, 7, 8, 9]
},{
"input": [107, 241, 32, 77, 134, 181, 116, 245, 145, 108, 44, 29, 167, 64, 21, 65, 77, 217, 166, 168, 123, 50, 221, 123],
"output": [21, 29, 32, 44, 50, 64, 65, 77, 77, 107, 108, 116, 123, 123, 134, 145, 166, 167, 168, 181, 217, 221, 241, 245]
}]
}
]
}