Skip to content
Snippets Groups Projects
Commit 5e4d636b authored by Simon Katan's avatar Simon Katan
Browse files

Mock Turtle forgets

parent 9829e406
Branches master
No related merge requests found
#!/bin/bash
checksums=( "11194" "25841" )
words=("body" "conflict")
checksums=( "01112" "23824" "40805" "xxxxx" "65646" )
words=("cod" "inventor" "journey" "xxxxx" "forest")
mark=0
command="python"
function loadPython {
......@@ -57,7 +58,7 @@ function checkWord {
if [ "$crc" = "${checksums[$1]}" ] ; then
isMemoryValid=true
local level=$((203 + $1))
local level=$((200 + $1))
$command baseutils.py $filename "score" $level ${words[$1]}
elif [ "$crc" = "${checksums[$prevIndex]}" ]; then
isPrevMemoryValid=true
......@@ -72,78 +73,159 @@ function pause {
local count=0
while [ $count -lt $1 ]; do
echo ...
sleep 2
let count=count+1
sleep 2
let count=count+1
done
}
function speech1 {
function task1 {
clear
pause 1
echo "Hi"
pause 1
echo "I see that you have come from my future."
echo "It’s so nice of canary.bird to have brought you here. Let me introduce myself. "
pause 1
echo "I am the famous mock turtle."
pause 1
echo "What do you mean you’ve never heard of a mock turtle !"
pause 1
echo "I’m the thing that Mock Turtle Soup is made from."
pause 1
clear
echo "I’m very sad. Can you help me ?"
pause 1
echo "Great I knew you would."
pause 1
clear
echo "I am very old and I used to have so many memories"
pause 1
echo "but now they have all slipped away."
pause 1
echo "Check the memories.txt in this directory and you will see that it’s totally blank"
pause 1
echo "It wasn’t always this way."
pause 1
clear
echo "My mind used to be full of rich and delicious memories."
pause 1
echo "Now I need you to find them"
pause 1
echo "I hear that you have just learnt how to use a strange tool called git which can help you recover things when you’ve lost them."
pause 1
echo "Let’s start by recovering my very first memory."
pause 1
echo "I am on long and strange journey"
echo "Use 'git log --oneline' to find out its name and then cut and paste this into the first line of my memories."
pause 1
echo "use 'git log --oneline -5' and you can see the many strange places I have been"
echo "Be sure to use a proper code editor like atom or sublime. Don't use textedit or notepad !"
pause 1
echo "Add these places to my memories"
echo "Once you have done this RUNME again"
pause 1
echo "commit the changes and then RUNME again."
}
function task2 {
clear
echo "Ah yes school that was my first memory."
pause 1
echo "I went to school in the sea."
pause 1
echo "Most of my classmates were fish."
pause 1
echo "Tuna mostly but also some cod"
pause 1
echo "Nobody understood me there."
pause 1
echo "It was a sad and lonely time."
pause 1
echo "Perhaps you can help me find a happier memory ?"
pause 1
clear
echo "I think my second year of school was a little happier"
pause 1
echo "Find the commit using 'git log --oneline' and travel back in time by using 'git checkout' "
pause 1
pause 1
echo "When you go back in time my memories will be different"
pause 1
echo "Don't be alarmed. This is totally natural."
pause 1
echo "However, make sure you use git 'commit -am' to store these memories first or they will be lost again."
pause 1
echo "Once you have travelled back in time, RUNME and I will tell you my memories from that time."
pause 1
echo "Return to this time (the master branch) with the happy memory and add it to a new line in memories.txt"
}
function speech2 {
function task3 {
clear
echo "During my journey something strange has happened to me."
echo "Ah Tortoise yes I remember her."
pause 1
echo "Something caused my conciousness to become detatched from my brain."
echo "Thankyou I feel much better about my school days now."
pause 1
echo "You are talking to my conciousness but my brain is somewhere out there too."
echo "Ah I remember so much more now"
pause 1
echo "Use 'git log --all --oneline --graph --decorate' to see the branch where they parted ways."
echo "After I left school I became an inventor"
pause 1
echo "I need you to merge them back together, but this will be tricky"
pause 1
echo "First make a local branch here using 'git branch' ... don't forget to add a name for it"
pause 1
echo "now checkout the remote branch called myBrain"
pause 1
echo "once you are there make another local branch in the same way"
pause 1
echo "finally merge the two branches together with 'git merge' ."
echo "I would have been a great success but for one problem"
pause 1
echo "With each new invention I forgot the last"
pause 3
clear
echo "Use 'git tag -l' to view all the tags for my inventions"
pause 1
echo "There will undoubtedly be conflicts between my conciousness and my brain."
echo "Each tagged commit has an invention in it in a file called inventions.txt"
pause 1
echo "Fix these by editing memories.txt so that all of the memories are included but nothing else"
echo "Now use the form 'git checkout tagName -- inventions.txt' to bring each invention to the present"
pause 1
echo "Commit the changes and them RUNME again"
echo "Notice that each inventions.txt replaces the old inventions.txt"
pause 1
echo "Luckily you are here so that you can help me to not forget them"
pause 1
echo "Each time open inventions.txt and cut and paste the invention to a new line of memories.txt"
pause 1
echo "When you have found all of my inventions RUNME again"
}
function speech3 {
function task4 {
clear
echo "Everything is becoming clearer to me now"
pause 1
echo "Something is coming out the fog of my memory"
pause 1
echo "I seem to remember something about a long journey"
pause 1
echo "Use 'git branch -r' to find a remote branch for this"
pause 1
echo "Then use 'git checkout' to explore the branch and RUNME"
pause 1
echo "When you go back in time, all of the current memories will disappear"
pause 1
echo "Don't be alarmed. This is totally natural as they won't have happened yet."
pause 1
echo "However you must commit the current memories here first using 'git commit -am'"
pause 1
echo "I wouldn't want to lose those wonderful memories again."
}
function task5 {
clear
echo "Thankyou I can finally stop this travelling"
echo "Thankyou so much."
pause 1
echo "I can remember everything now !"
pause 1
echo "I've just remembered something very important that Rabbit told me"
pause 1
echo "Use 'git log --all --oneline --graph --decorate' to see what you have done for me."
echo "Your name is $username right ? "
pause 1
echo "My conciousness and brain are now rejoined."
echo "Well then you need to go see Caterpillar in the forest"
pause 1
echo "The final stage is to bring all of these changes to the present."
echo "You'll find him by the magic toadstool"
pause 1
echo "You will need to merge this branch with master."
pause 1
echo "And you will need to edit memories.txt for conflicts"
echo "http://gitlab.doc.gold.ac.uk/underland/magicToadstool.git"
pause 1
echo "But you are an expert time traveller now so I don't think you need help from me."
pause 1
echo "Just one bit of advice ..."
echo "Don't forget to keep you score file safe (you know the one thats starts with 'aiw_'). "
pause 1
echo "Don't forget to commit your changes here first. "
pause 1
echo "Maybe you could store it in a repo of your own ?"
}
function badMemory {
......@@ -174,27 +256,56 @@ elif [ ! -f $filename ] ;then
echo "Have another go".
exit
else
checkScript $1
if [ $mark -eq 8 ]; then
if [ $mark -eq 1 ]; then
checkWord 0
if [ "$isMemoryValid" = true ]; then
speech2
else
speech1
fi
elif [ $mark -eq 10 ]; then
if [ "$isMemoryValid" = true ]; then
task2
else
task1
#echo "fail"
fi
elif [ $mark -eq 4 ]; then
checkWord 1
if [ "$isMemoryValid" = true ]; then
speech3
else
speech2
fi
else
badMemory
rm baseutils.py
rm levelCodes
fi
if [ "$isMemoryValid" = true ]; then
task3
elif [ "$isPrevMemoryValid" = true ]; then
task2
else
badMemory
fi
elif [ $mark -eq 6 ]; then
checkWord 2
if [ "$isMemoryValid" = true ]; then
task4
elif [ "$isPrevMemoryValid" = true ]; then
task3
else
badMemory
fi
elif [ $mark -eq 8 ]; then
task4
rm baseutils.py
rm levelCodes
elif [ $mark -eq 10 ]; then
checkWord 4
if [ "$isMemoryValid" = true ]; then
task5
else
pause 1
echo "Something is wrong with your memories."
pause 1
echo "Have you resolved your conflicts ?"
pause 1
fi
elif [ $mark -eq 11 ]; then
task5
rm baseutils.py
rm levelCodes
else
badMemory
rm baseutils.py
rm levelCodes
fi
fi
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment