marble-machinations/levels/chapter_04.json
2024-12-24 22:43:21 +01:00

53 lines
No EOL
2 KiB
JSON

{
"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]
}]
}
]
}