From 4af856235e0be0086b271828a3bf6df76eaeca5a Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Thu, 22 Oct 2020 22:19:30 +0200 Subject: [PATCH] Better reorder level --- cardgame.gd | 30 +++++++++++--- levels/time-machine/reorder | 80 +++++++++++++++++++++++++++++-------- levels/time-machine/welcome | 2 +- 3 files changed, 89 insertions(+), 23 deletions(-) diff --git a/cardgame.gd b/cardgame.gd index 68db0ee..4aa54d2 100644 --- a/cardgame.gd +++ b/cardgame.gd @@ -45,12 +45,12 @@ var cards = [ "description": "Make a new commit!", "energy": 1 }, - { - "command": 'git branch new', - "arg_number": 1, - "description": "Create a new timeline.", - "energy": 1 - }, +# { +# "command": 'git branch new', +# "arg_number": 1, +# "description": "Create a new timeline.", +# "energy": 1 +# }, { "command": 'git merge', "arg_number": 1, @@ -75,6 +75,24 @@ var cards = [ "description": "Give timelines to a colleague.", "energy": 1 }, + { + "command": 'git rebase -i', + "arg_number": 1, + "description": "Make changes to the events in your current timeline, back to the commit you drag this to.", + "energy": 1 + }, + { + "command": 'git reset --hard', + "arg_number": 1, + "description": "Reset current label to the specified commit.", + "energy": 1 + }, + { + "command": 'git cherry-pick', + "arg_number": 1, + "description": "Repeat the specified action on top of your current timeline.", + "energy": 1 + }, # { # "command": 'git update-ref -d', # "arg_number": 1, diff --git a/levels/time-machine/reorder b/levels/time-machine/reorder index 186f566..a26eac4 100644 --- a/levels/time-machine/reorder +++ b/levels/time-machine/reorder @@ -2,27 +2,75 @@ title = Reodering events [description] -Oops, looks like one of our time agents messed up here. Can you put the events back into their correct order? +Oops, looks like there's something messed up here. Can you put the events back into their correct order? + +There are two ways to do this: You can drag the "interactive rebase" card to the commit before the one you want to change, and then reorder the lines in the file that opens. + +Or you can reset the main tag to the very first commit, and then cherry-pick single commits in the order you want. You have cards for both approaches! [setup] -mkdir bakery +echo "You just woke up. -echo has baguette > bakery/bob -echo has money > alice +You are NOT wearing underwear. + +You are NOT wearing pants. + +You are NOT wearing a shirt. + +You are NOT wearing shoes." > you git add . -git commit -m "Alice is hungry" -echo has money > bakery/bob -echo has baguette > alice -git commit -a -m "Alice leaves the bakery" +git commit -m "The Beginning" -echo has baguette > bakery/bob -echo has money > bakery/alice -git rm alice -git add . -git commit -a -m "Alice enters the bakery" +echo "You just woke up. -echo has money > bakery/bob -echo has baguette > bakery/alice -git commit -a -m "Alice buys a baguette" +You are NOT wearing underwear. + +You are NOT wearing pants. + +You are NOT wearing a shirt. + +You are wearing shoes." > you +git commit -am "Put on shoes" + +echo "You just woke up. + +You are NOT wearing underwear. + +You are wearing pants. + +You are NOT wearing a shirt. + +You are wearing shoes." > you +git commit -am "Put on pants" + +echo "You just woke up. + +You are wearing underwear. + +You are wearing pants. + +You are NOT wearing a shirt. + +You are wearing shoes." > you +git commit -am "Put on underwear" + +echo "You just woke up. + +You are wearing underwear. + +You are wearing pants. + +You are wearing a shirt. + +You are wearing shoes." > you +git commit -am "Put on shirt" + +[win] + +{ git log main --oneline | grep -Pz "shoes[\s\S]*pants[\s\S]*underwear"; } && { test "$(git log main --oneline | wc -l)" -eq 5; } + +[congrats] + +Feel free to reset the level and try the other strategy! Which one do you like better? diff --git a/levels/time-machine/welcome b/levels/time-machine/welcome index 31d7f92..6359785 100644 --- a/levels/time-machine/welcome +++ b/levels/time-machine/welcome @@ -4,7 +4,7 @@ title = Welcome! Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes! -Each yellow box is a frozen point in time, we call them "commits"! You can travel to one by dragging the "checkout" card to it, and you can go back to the present by dragging it on the blue "main" tag! +Each yellow box is a frozen point in time, we call them "commits"! You can travel to one by dragging the "checkout" card to it, and you can go back to the present by dragging it on the blue "main" tag! (Try it!) The grey panel shows your current environment - click on an object to inspect or modify it!