Reorder levels and chapters into a better sequence

This commit is contained in:
blinry 2021-01-07 12:57:31 +01:00
parent 5c1f1ce722
commit c99a35d54f
40 changed files with 128 additions and 288 deletions

View file

@ -23,8 +23,7 @@ Wanna build your own level? Great! Here's how to do it:
1. Run the game the easiest way to do so is to run `godot scenes/main.tscn` from the project directory.
1. Get a bit familiar with the levels which are currently there.
1. Take a look into the `levels` directory. It's split into chapters, and each level is a file.
1. Make a copy of an existing level or start writing your own. See the documention of the format below. Put your level in the `contrib` chapter.
1. The dropdowns in the game will automatically refresh to contain your level, you don't need to restart the game.
1. Make a copy of an existing level or start writing your own. See the documention of the format below.
1. Write and test your level. If you're happy with it, feel free to send it to us in a pull request! <3
### Level format

View file

@ -1,33 +0,0 @@
title = This is the level's title
[description]
This text will be shown when the level starts.
It describes the task or puzzle the player can solve.
[congrats]
This text will be shown after the player has solved the level.
Can contain additional information, or bonus exercises.
[setup]
# Bash commands that set up the initial state of the level. An initial
# `git init` is always done automatically. The default branch is called `main`.
echo You > people_who_are_awesome
git add .
git commit -m "Initial commit"
[win]
# Bash commands that check whether the level is solved. Write these as if you're
# writing the body of a Bash function. Make the function return 0 if it's
# solved, and a non-zero value otherwise. You can use `return`, and also, Bash
# functions return the exit code of the last statement, which sometimes allows
# very succinct checks.
# Check whether the file has at least two lines in the latest commit:
test "$(git show HEAD:people_who_are_awesome | wc -l)" -ge 2

View file

@ -1,32 +0,0 @@
[setup]
git commit --allow-empty -m "fu"
git commit --allow-empty -m "fu"
git commit --allow-empty -m "fu"
git commit --allow-empty -m "fu"
git commit --allow-empty -m "fu"
git commit --allow-empty -m "fu"
git branch branch1
git checkout HEAD~4
git commit --allow-empty -m "fa"
git commit --allow-empty -m "fa"
git branch branch2
git checkout HEAD~2
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git commit --allow-empty -m "fi"
git branch branch3
git checkout main
git merge branch1
git merge branch2
git merge branch3

View file

@ -1,26 +0,0 @@
[description]
So you've been working on a project for a while, and decide you want to put it in a Git repository.
Here's how to do it! First, you initialize a new Git repository in your current directory:
git init
Then say that you want to record the current state of all files:
git add .
And then you make a commit, which gives the current state a description, a date, and your name:
git commit
[setup]
mkdir recipes
echo -e "blueberries\nflour" > recipes/blueberry_cake.txt
echo -e "water\ncarrots" > recipes/carrot soup.txt
echo "Very good recipes!" > README.md
[win]
test "$(git rev-parse HEAD^{tree})" = 1e02e3151284d0e22cd9b07ca5c5dbae2f3cb521

View file

@ -1,43 +0,0 @@
[description]
(This is not a real puzzle yet.)
Try merging the two branches together!
git merge <otherbranch>
[setup]
echo ? > bikeshed_color
git add .
git commit -m "Initial commit"
echo green > bikeshed_color
git commit -a -m "My suggestion"
git switch -c alternative HEAD^
echo blue > bikeshed_color
git commit -a -m "This is way better"
git switch main
[setup goal]
echo ? > bikeshed_color
git add .
git commit -m "Initial commit"
echo green > bikeshed_color
git commit -a -m "My suggestion"
git switch -c alternative HEAD^
echo blue > bikeshed_color
git commit -a -m "This is way better"
git switch main
git merge alternative
echo blue-green > bikeshed_color
git add .
git commit -m "Merge"
git prune

View file

@ -1,29 +0,0 @@
[description]
You want to push your new commits to the server, but someone has already pushed their own changes.
In this situation, you need to pull first! Try that here - you'll have to resolve a merge conflict. Push your changes afterwards.
[congrats]
Good job! Here's some additional info: banana!
[setup yours]
echo fu > file
git add .
git commit -m "Initial commit"
git push -u origin main
echo fi > file
git commit -a -m "Fi is good"
[setup origin]
echo fa > file
git add .
git commit -a -m "Fa is good"
[win origin]
test "$(git rev-parse HEAD^1^)" = "$(git rev-parse HEAD^2^)"

View file

@ -1,20 +0,0 @@
description = Rebase all branches on top of the main branch, so that the commits are in alphabetical order, and then point the main branch to the top commit.
[setup]
git commit --allow-empty -m A
git commit --allow-empty -m B
git commit --allow-empty -m C
git switch -c side1 main~1
git commit --allow-empty -m D
git commit --allow-empty -m E
git switch -c side2 main~2
git commit --allow-empty -m F
git checkout main
[win]
diff <(git log --pretty=%s main) <(echo -e "F\nE\nD\nC\nB\nA")

View file

@ -1,8 +0,0 @@
[setup local]
git commit --allow-empty -m "1"
git commit --allow-empty -m "2"
git commit --allow-empty -m "3"
git push -u origin main
[setup origin]

View file

@ -1 +0,0 @@
sandbox

View file

@ -1,33 +0,0 @@
title = Your first remote
[description]
A friend has asked you to help with an essay about hobbies! She has already started to write a list, started tracking it in a Git repository. You can get a copy by typing
git pull friend main
Help her by adding at least two more items to the list! When you're done, commit your result and use
git push friend main
to send it to her copy of the repository!
[congrats]
"Thanks, these are some really nice hobbies! Hope we can do that together soon!"
[setup]
[setup friend]
echo "~ Best hobbies ~
- Collecting stamps
- Looking at clouds" >> hobbies.txt
git add .
git commit -m "Initial list (I definitely need more)"
[win friend]
test "$(git show HEAD:hobbies.txt |wc -l)" -ge 6

View file

@ -1,18 +1,11 @@
title = Looking into the past
title = Getting the last version
cards = checkout-file
[description]
You've been working on your essay for a while. But - ughh! Now your cat walks over your keyboard and "helps you", so now it's all messed up again! :/
You've been working on your essay for a while. But - ughh! Now your cat walks over your keyboard and "helps you", so now it's all messed up! :/
To restore your essay from the last backup, type:
git checkout essay.txt
To restore an older version, for example, from two backups before the latest one, type:
git checkout HEAD~2 essay.txt
For nostalgic reasons, restore the very first backup you made!
But Git is here to help! To discard all changes your cat made, and go back to the version in the last commit, use `checkout`!
[setup]
@ -34,4 +27,5 @@ blaaaargh" > essay.txt
[win]
diff essay.txt <(echo "A")
# Restore the version from the last commit.
cat essay.txt | grep D

39
levels/intro/first-remote Normal file
View file

@ -0,0 +1,39 @@
title = Working together
cards = pull commit-auto push
[description]
A friend has asked you to help with an essay about hobbies! She has already started to write a list, started tracking it in a Git repository. You can get a copy by using `git pull`!
[congrats]
"Thanks, these are some really nice hobbies! Hope we can do that together soon!"
[setup]
echo "~ Best hobbies ~" > hobbies.txt
git add .
git commit -m "Initial version"
git push -u friend main
[setup friend]
git checkout main
echo "
- Collecting stamps
- Looking at clouds" >> hobbies.txt
git add .
git commit -m "Added two hobbies"
[win]
# Help her by adding at least two more items to the list!
test "$(cat hobbies.txt |wc -l)" -ge 6
[win friend]
# When you're done, commit your result and use `git push` to send it to her copy of the repository!
test "$(git show main:hobbies.txt |wc -l)" -ge 6

View file

@ -1,15 +1,12 @@
title = Why Git?
cards = file-copy
[description]
(This chapter is not a complete introduction to Git yet, but it will explain some of the basic concepts to you.)
So you've been working on an essay about goldfish. You can look at the backup copies you made by clicking on them!
But look - something went wrong in the latest version of the file! Maybe it has been infected with a vowel-eating virus?
Make a new version (with the number 5) from the last version that's still okay, and add at least two more lines to it!
[congrats]
Good that you had that backup, huh?
@ -26,27 +23,31 @@ rm -rf .git
echo "~ Why goldfish are the best pets ~
(I still need to write this.)" >> essay_1.txt
(I still need to write this.)" >> essay1.txt
echo "~ Why goldfish are the best pets ~
- They don't make any noise.
- They are pretty. (I should probably put this higher in the list?)" >> essay_2.txt
- They are pretty. (I should probably put this higher in the list?)" >> essay2.txt
echo "~ Why goldfish are the best pets ~
- They are pretty.
- They don't pee on the carpet.
- They don't make any noise." >> essay_3.txt
- They don't make any noise." >> essay3.txt
echo "~ Why gldfsh r th bst pts ~
- Thy r prtty.
- Thy dn't p n th crpt.
- Thy dn't mk ny ns." >> essay_4.txt
- Thy dn't mk ny ns." >> essay4.txt
[win]
test "$(cat *5.txt | wc -l )" -ge 7 && grep carpet *5.txt
# Make a new version (with the number 5) from the last version that's still okay
cat essay5.txt | grep carpet
# And add at least two more lines to it!
test "$(cat essay5.txt | wc -l )" -ge 7

28
levels/intro/restore Normal file
View file

@ -0,0 +1,28 @@
title = Looking into the past
cards = checkout-from
[description]
You've been working on your essay for a while. But you're not happy with the changes you've made recently. You want to go back to the version called "Best version"!
No problem, you can use the `checkout` card to restore your essay from an older commit!
[setup]
echo "Initial version" > essay.txt
git add .
git commit -m "Initial commit"
echo "Improved version" > essay.txt
git commit -a -m "Improved version"
echo "Best version" > essay.txt
git commit -a -m "Best version"
echo "Less-good version" > essay.txt
git commit -a -m "Less-good version"
[win]
# For nostalgic reasons, restore the very first backup you made!
diff essay.txt <(echo "Best version")

View file

@ -1,3 +1,5 @@
motivation
setup
checkout
restore
first-remote

View file

@ -1,4 +1,5 @@
title = A better way
cards = init commit-auto
[description]
@ -6,18 +7,11 @@ One month later, you're woking on an essay about tardigrades!
This time, a friend has recommended that you use the version control system Git to keep backups of your file.
Currently, your directory only contains your essay. To initialize a Git repository in your directory, type:
Currently, your directory only contains your essay. To initialize a Git repository in your directory, use the `init` card!
git init
Then, each time you want to make a backup, use the `commit` card!
Then, each time you want to make a backup, type:
git add essay.txt
git commit
Enter a description of what you changed in the editor that opens and click save.
That way, you've made a backup of the current version of the file. Then add at least two more lines, and make another backup by repeating the add and the commit commands.
That way, you've made a backup of the current version of the file.
[setup]
@ -30,4 +24,11 @@ echo "~ Why tardigrades are cool ~
[win]
test -d .git && git rev-parse HEAD^ && test "$(git show HEAD:essay.txt | wc -l)" -ge 6
# Initialize a Git repository
test -d .git
# And make another commit
test -d .git && git rev-parse HEAD^
# Add at least two more lines.
test "$(git show HEAD:essay.txt | wc -l)" -ge 6

3
levels/sandbox/empty Normal file
View file

@ -0,0 +1,3 @@
title = Empty sandbox
[setup]

View file

@ -1,4 +1,4 @@
title = Sandbox
title = Three commits
[setup]
@ -14,11 +14,7 @@ git commit -am "Who's there?"
git branch not_main
[win]
test true
[congrats]
[description]
That's all for now! Here's a sandbox you can play around in.

View file

@ -1,6 +1,11 @@
stash
intro
files
index
branches
merge
tags
remotes
changing-the-past
shit-happens
time-machine
stash
low-level

View file

@ -1,13 +0,0 @@
init
checkout-commit
branching
merge
branches
conflict
pull-push
rebase
reorder
bisect
steps
split
sandbox

View file

@ -6,8 +6,13 @@
},
{
"id": "checkout",
"command": "git checkout [commit, ref, file]",
"description": "Drag this card to a commit or to a branch to travel to it!\n\nAlternatively, reset changes in a local file."
"command": "git checkout [commit, ref]",
"description": "Drag this card to a commit or to a branch to travel to it!"
},
{
"id": "checkout-file",
"command": "git checkout [file]",
"description": "Reset changes in a local file."
},
{
"id": "checkout-from",
@ -21,8 +26,8 @@
},
{
"id": "commit-auto",
"command": "git add .; git commit",
"description": "Make a new commit containing your current environment!\nYou'll be asked to enter a short description of what you changed."
"command": "git add .; git commit -m \"New commit\"",
"description": "Make a new commit containing your current environment!"
},
{
"id": "merge",
@ -143,5 +148,10 @@
"id": "file-rename",
"command": "mv [file] [string]",
"description": "Rename a new file."
},
{
"id": "file-copy",
"command": "cp [file] [string]",
"description": "Make a copy of a file."
}
]

View file

@ -72,10 +72,10 @@ func load_level(level_id):
level_description.bbcode_text = level.description[0]
level_congrats.bbcode_text = level.congrats
level_name.text = level.title
if levels.chapters[game.current_chapter].levels[game.current_level].cards.size() == 0:
cards.redraw_all_cards()
else:
cards.draw(levels.chapters[game.current_chapter].levels[game.current_level].cards)
#if levels.chapters[game.current_chapter].levels[game.current_level].cards.size() == 0:
# cards.redraw_all_cards()
#else:
cards.draw(levels.chapters[game.current_chapter].levels[game.current_level].cards)
for r in repositories_node.get_children():
r.queue_free()