-
Notifications
You must be signed in to change notification settings - Fork 0
/
play
executable file
·49 lines (46 loc) · 1.45 KB
/
play
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
game=$1
if [[ $game == '--gitpod' ]]; then
echo ''
echo ''
echo "🎉🎉🎮 Let's play some games! 🎉🎉"
echo ''
echo 'There are many to choose from and you can even play them'
echo 'in your browser with sound and a gamepad by going to https://philschatz.com/puzzlescript/'
echo ''
read -p "Do you want to start with the game SwapBot [Enter] or choose from some popular ones [c]? " prompt
if [[ $prompt =~ [cC] ]]; then
game=''
else
game='swapbot'
fi
fi
if [[ $game == '--all' ]]; then
echo 'Here are all the games sorted by size (not quality):'
for game_file in $(find ./games/ -name '*.parsed.json' -type f -printf $'%s\t%f\n' | sort -k1,1n | sed 's/.*\t//'); do
game_name=${game_file::-12}
echo " ${game_name}"
done
exit 0
fi
if [[ $game ]]; then
game_file="./games/${game}.parsed.json"
[[ -f $game_file ]] || (echo "Game '${game}' not found."; exit 1)
cargo run --release -- ${game_file}
else
echo 'Usage: ./play [--all] [game]'
echo 'Here are some fun games to start with:'
echo ''
echo ' entanglement-one'
echo ' swapbot'
echo ' mirror-isles'
echo ' skipping-stones'
echo ' pushcat-jr'
echo ' pot-wash-panic'
echo ' push'
echo ''
echo ' (add your favorite here with a Pull Request!)'
echo ''
echo 'Or pass --all to see a list of all games sorted by size'
exit 0
fi