Compare commits
4 commits
43130b665d
...
fea00da8a3
Author | SHA1 | Date | |
---|---|---|---|
fea00da8a3 | |||
0d661e2d38 | |||
4344e69a10 | |||
a963722b27 |
13 changed files with 51 additions and 36 deletions
|
@ -10,6 +10,7 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
|||
- background colour setting
|
||||
- hotkeys for everything
|
||||
- more levels
|
||||
- scroll output bytes
|
||||
- make direct power (comparator -> machine) work, (needs storing power direction in machine tiles)
|
||||
- cut selections, copy to system clipboard
|
||||
- timestamps in solutions and blueprints
|
||||
|
|
|
@ -4,12 +4,8 @@
|
|||
"name": "Zero",
|
||||
"description": "learn how to output data",
|
||||
"init_board": "\n o \n\n I\n\n",
|
||||
"stages": [
|
||||
{
|
||||
"input": [],
|
||||
"output": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
"stages": [{
|
||||
"input": [],
|
||||
"output": [0]
|
||||
}]
|
||||
}
|
|
@ -6,5 +6,11 @@
|
|||
"stages": [{
|
||||
"input": "Hello, world!",
|
||||
"output": "Hello, world!"
|
||||
},{
|
||||
"input": "Meow!",
|
||||
"output": "Meow!"
|
||||
},{
|
||||
"input": "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"
|
||||
}]
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Odd Cat",
|
||||
"description": "copy only the odd numbers from the input",
|
||||
"stages": [{
|
||||
"input": [1, 2, 3, 4, 5, 6, 7],
|
||||
"output": [1, 3, 5, 7]
|
||||
},{
|
||||
"input": [112, 92, 51, 79, 112, 96, 84, 59, 195, 208, 137, 196, 68, 204, 82, 148, 251, 56, 105, 38, 63, 204, 240, 220, 180, 54, 211, 17, 82, 17, 181, 43],
|
||||
"output": [51, 79, 59, 195, 137, 251, 105, 63, 211, 17, 17, 181, 43]
|
||||
}]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Fives",
|
||||
"description": "count how many fives are in the input",
|
||||
"stages": [{
|
||||
"input": [6, 5, 5, 3, 5, 0],
|
||||
"output": [3]
|
||||
},{
|
||||
"input": [182, 236, 71, 5, 5, 242, 29, 99, 19, 230, 217, 5, 67, 5, 223, 224, 70, 243, 3, 74, 242, 5, 171, 31, 96, 5, 169, 70, 5, 163, 72, 5, 172, 148, 5, 208, 28, 220, 17, 184, 172, 238, 5, 105, 119, 5, 106, 100, 73, 53, 42, 221, 155, 5, 74, 100, 161, 36, 16, 239, 193, 164, 64, 162, 222, 155, 107, 14, 45, 52, 159, 31, 199, 124, 129, 0],
|
||||
"output": [12]
|
||||
}]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Length",
|
||||
"description": "count how many numbers are in the input, until the first zero",
|
||||
"stages": [{
|
||||
"input": [1, 87, 9, 0],
|
||||
"output": [3]
|
||||
},{
|
||||
"input": [182, 236, 71, 5, 5, 242, 29, 99, 19, 230, 217, 5, 67, 5, 223, 224, 70, 243, 3, 74, 242, 5, 171, 31, 96, 5, 169, 70, 5, 163, 72, 5, 172, 148, 5, 208, 28, 220, 17, 184, 172, 0],
|
||||
"output": [41]
|
||||
}]
|
||||
|
|
|
@ -6,5 +6,8 @@
|
|||
"stages": [{
|
||||
"input": "9834726\u0000Hello, worlg!",
|
||||
"output": "Hello, worlg!"
|
||||
},{
|
||||
"input": "aonmbgoirf\u0000this is just to make sure you don't hardcode the output for a better score",
|
||||
"output": "this is just to make sure you don't hardcode the output for a better score"
|
||||
}]
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Reverse",
|
||||
"description": "read input until zero and output the same thing in reverse",
|
||||
"stages": [{
|
||||
"input": "woem\u0000",
|
||||
"output": "meow"
|
||||
},{
|
||||
"input": "tnropmi yrev\u0000",
|
||||
"output": "very impornt"
|
||||
}]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Lowercase",
|
||||
"description": "Convert text to lowercase",
|
||||
"stages": [{
|
||||
"input": "FROM THE MOMENT I UNDERSTOOD THE WEAKNESS OF MY FLESH, IT DISGUSTED ME",
|
||||
"output": "from the moment i understood the weakness of my flesh, it disgusted me"
|
||||
},{
|
||||
"input": "I CraVeD tHE strEnGTH AND CerTAinTy oF STeeL",
|
||||
"output": "i craved the strength and certainty of steel"
|
||||
}]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Numbers",
|
||||
"description": "Convert input numbers to text, separated by spaces (32)\n'0' = 48, '1' = 49, '2' = 50, and so on",
|
||||
"stages": [{
|
||||
"input": [8, 7, 1],
|
||||
"output": "8 7 1"
|
||||
},{
|
||||
"input": [85, 114, 32, 103, 97, 121, 58, 51],
|
||||
"output": "85 114 32 103 97 121 58 51"
|
||||
}]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"name": "Numbers 2",
|
||||
"description": "Convert input numbers from text, separated by spaces (32)\n'0' = 48, '1' = 49, '2' = 50, and so on",
|
||||
"stages": [{
|
||||
"input": "1 2 3",
|
||||
"output": [1, 2, 3]
|
||||
},{
|
||||
"input": "85 114 32 103 97 121 58 51",
|
||||
"output": [85, 114, 32, 103, 97, 121, 58, 51]
|
||||
}]
|
||||
|
|
|
@ -303,7 +303,7 @@ impl Editor {
|
|||
let stage = &self.level.stages()[i];
|
||||
if self.popup == EndPopup::None {
|
||||
if stage.output().as_bytes() == self.machine.output() {
|
||||
if i < self.level.stages().len() {
|
||||
if i + 1 < self.level.stages().len() {
|
||||
self.stage = Some(i + 1);
|
||||
self.total_steps += self.machine.step_count();
|
||||
self.reset_machine();
|
||||
|
@ -757,15 +757,8 @@ impl Editor {
|
|||
|
||||
draw_usize(d, textures, self.machine.step_count(), 420, 4, 9, 2);
|
||||
if self.stage > Some(0) {
|
||||
draw_usize(
|
||||
d,
|
||||
textures,
|
||||
self.total_steps + self.machine.step_count(),
|
||||
420,
|
||||
44,
|
||||
9,
|
||||
2,
|
||||
);
|
||||
let total_steps = self.total_steps + self.machine.step_count();
|
||||
draw_usize(d, textures, total_steps, 420, 44, 9, 2);
|
||||
}
|
||||
|
||||
draw_usize(d, textures, self.step_time as usize, 260, 42, 9, 1);
|
||||
|
@ -967,11 +960,22 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
let output_x = 370;
|
||||
let y = footer_top as i32 + 5;
|
||||
if let Some(i) = self.stage {
|
||||
d.draw_text("stage", 370, y, 20, Color::GREEN);
|
||||
let shown_stage = if self.sim_state == SimState::Editing {
|
||||
0
|
||||
} else {
|
||||
i + 1
|
||||
};
|
||||
let text = format!("{shown_stage}/{}", self.level.stages().len());
|
||||
d.draw_text(&text, 370, y + 20, 20, Color::LIGHTGREEN);
|
||||
}
|
||||
|
||||
let output_x = 440;
|
||||
let output_cell_width = 43;
|
||||
let output_cells = (d.get_screen_width() - output_x) as usize / output_cell_width as usize;
|
||||
|
||||
let y = footer_top as i32 + 5;
|
||||
if simple_button(d, output_x, y + 70, 65, 15) {
|
||||
self.output_as_text = !self.output_as_text
|
||||
}
|
||||
|
|
16
src/level.rs
16
src/level.rs
|
@ -67,22 +67,6 @@ impl Level {
|
|||
pub fn stages(&self) -> &[Stage] {
|
||||
&self.stages
|
||||
}
|
||||
|
||||
// pub fn inputs(&self) -> &[u8] {
|
||||
// self.inputs.as_bytes()
|
||||
// }
|
||||
|
||||
// pub fn outputs(&self) -> &[u8] {
|
||||
// self.outputs.as_bytes()
|
||||
// }
|
||||
|
||||
// pub fn input_is_text(&self) -> bool {
|
||||
// matches!(self.inputs, IOData::Text(_))
|
||||
// }
|
||||
|
||||
// pub fn output_is_text(&self) -> bool {
|
||||
// matches!(self.outputs, IOData::Text(_))
|
||||
// }
|
||||
}
|
||||
|
||||
impl Stage {
|
||||
|
|
Loading…
Add table
Reference in a new issue