diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-01-07 22:41:41 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-01-07 22:41:41 -0500 |
commit | 2967ff07fa5b5bcbf0983c225336faa8b4494e47 (patch) | |
tree | 31f7b01a6f93516a3f1c8d435aef63a6a92c575b | |
parent | 05111ba3e59b96c51e1fa7c24d673eb2d77ec1cd (diff) | |
download | sok-2967ff07fa5b5bcbf0983c225336faa8b4494e47.tar.bz2 sok-2967ff07fa5b5bcbf0983c225336faa8b4494e47.zip |
add levels, warping
-rw-r--r-- | src/text/main.c | 682 |
1 files changed, 669 insertions, 13 deletions
diff --git a/src/text/main.c b/src/text/main.c index bcf53a1..80bdc65 100644 --- a/src/text/main.c +++ b/src/text/main.c @@ -6,18 +6,663 @@ #define UNUSED(a) ((void) (a)) -static const char * const -LEVELS[] = { - "5#|#@$.#|5#", - "7#|3#.3#|3#$3#|#.$@$.#|3#$3#|3#.3#|7#", -}; -#define NUM_LEVELS (sizeof(LEVELS) / sizeof(char*)) +#define CASE_DIGIT \ + case '0': \ + case '1': \ + case '2': \ + case '3': \ + case '4': \ + case '5': \ + case '6': \ + case '7': \ + case '8': \ + case '9': + +typedef struct { + char *pack, *name, *data; +} level_t; + +static const level_t +LEVELS[] = {{ + .pack = "Tutorials", + .name = "Hello World!", + .data = "5#|#@$.#|5#", +}, { + .pack = "Tutorials", + .name = "Plus", + .data = "7#|3#.3#|3#$3#|#.$@$.#|3#$3#|3#.3#|7#", +}, { + .pack = "Microban", + .name = "Level 1", + .data = "4#|# .#|# 3#|#*@ #|# $ #|# 3#|4#", +}, { + .pack = "Microban", + .name = "Level 2", + .data = "6#|#4 #|# #@ #|# $* #|# .* #|#4 #|6#", +}, { + .pack = "Microban", + .name = "Level 3", + .data = " 4#|3# 4#|#5 $ #|# # #$ #|# . .#@ #|9#", +}, { + .pack = "Microban", + .name = "Level 4", + .data = "8#|#6 #|# .**$@#|#6 #|5# #|4 4#", +}, { + .pack = "Microban", + .name = "Level 5", + .data = " 7#| #5 #| # .$. #|## $@$ #|# .$. #|#6 #|8#", +}, { + .pack = "Microban", + .name = "Level 6", + .data = "6# 5#|#4 3#3 #|# $$5 #@#|# $ #3.3 #|#3 8#|5#", +}, { + .pack = "Microban", + .name = "Level 7", + .data = "7#|#5 #|# .$. #|# $.$ #|# .$. #|# $.$ #|# @ #|7#", +}, { + .pack = "Microban", + .name = "Level 8", + .data = " 6#| # ..@#| # $$ #| ## 3#|3 # #|3 # #|4# #|#4 ##|# #3 #|#3 # #|3#3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 9", + .data = "5#|#. ##|#@$$ #|##3 #| ## #| ##.#|3 3#", +}, { + .pack = "Microban", + .name = "Level 10", + .data = "6 5#|6 #. #|6 #.# #|7#.# #|# @ $ $ $ #|# # # # 3#|#7 #|9#", +}, { + .pack = "Microban", + .name = "Level 11", + .data = " 6#| #4 #| # ##@##|3# # $ #|# ..# $ #|#7 #|# 6#|4#", +}, { + .pack = "Microban", + .name = "Level 12", + .data = "5#|#3 ##|# $ #|## $ 4#| 3#@. #| # .# #| #5 #| 7#", +}, { + .pack = "Microban", + .name = "Level 13", + .data = "4#|#. ##|#.@ #|#. $#|##$ 3#| # $ #| #4 #| # 3#| 4#", +}, { + .pack = "Microban", + .name = "Level 14", + .data = "7#|#5 #|# # # #|#. $*@#|#3 3#|5#", +}, { + .pack = "Microban", + .name = "Level 15", + .data = "5 3#|6#@##|#4 .* #|#3 #3 #|5#$# #|4 #3 #|4 5#", +}, { + .pack = "Microban", + .name = "Level 16", + .data = " 4#| # 4#| #5 ##|## ##3 #|#. .# @$##|#3 # $$ #|# .#4 #|10#", +}, { + .pack = "Microban", + .name = "Level 17", + .data = "5#|# @ #|#3.#|#3$##|#4 #|#4 #|6#", +}, { + .pack = "Microban", + .name = "Level 18", + .data = "7#|#5 #|#. . #|# ## ##|# $ #|3#$ #| #@ #| # #| 4#", +}, { + .pack = "Microban", + .name = "Level 19", + .data = "8#|#3 .. #|# @$$ #|5# ##|3 # #|3 # #|3 # #|3 4#", +}, { + .pack = "Microban", + .name = "Level 20", + .data = "7#|#5 3#|# @$$..#|4# ## #| #5 #| # 4#| # #| 4#", +}, { + .pack = "Microban", + .name = "Level 21", + .data = "4#|# 4#|# . . #|# $$#@#|##4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 22", + .data = "5#|#3 3#|#. . #|#3 # #|## # #| #@$$ #| #4 #| # 3#| 4#", +}, { + .pack = "Microban", + .name = "Level 23", + .data = "7#|# * #|#5 #|## # ##| #$@.#| #3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 24", + .data = "# 5#| #3 #|3#$$@#|#3 3#|#5 #|# . . #|7#", +}, { + .pack = "Microban", + .name = "Level 25", + .data = " 4#| # 3#| # $$ #|##3. #|# @$ #|#3 3#|5#", +}, { + .pack = "Microban", + .name = "Level 26", + .data = " 5#| # @ #| #3 #|3#$ #|# 3.#|# $$ #|3# #| 4#", +}, { + .pack = "Microban", + .name = "Level 27", + .data = "6#|#3 .#|# ## ##|# $$@#|# #3 #|#. 3#|5#", +}, { + .pack = "Microban", + .name = "Level 28", + .data = "5#|#3 #|# @ #|# $$3#|##. . #| #4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 29", + .data = "5 5#|5 #3 ##|5 #4 #| 6#3 #|##5 #. #|# $ $ @ ##|# 6#.#|#8 #|10#", +}, { + .pack = "Microban", + .name = "Level 30", + .data = "4#|# 3#|# $$ #|#3. #|# @$ #|#3 ##|5#", +}, { + .pack = "Microban", + .name = "Level 31", + .data = " 4#| ## #|##@$.##|# $$ #|# . . #|3#3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 32", + .data = " 4#|## 3#|#5 #|#.**$@#|#3 3#|## #| 4#", +}, { + .pack = "Microban", + .name = "Level 33", + .data = "7#|#. # #|# $ #|#. $#@#|# $ #|#. # #|7#", +}, { + .pack = "Microban", + .name = "Level 34", + .data = " 4#|3# 4#|#7 #|#@$***. #|#7 #|9#", +}, { + .pack = "Microban", + .name = "Level 35", + .data = " 4#| ## #| #. $#| #.$ #| #.$ #| #.$ #| #. $##| #3 @#| ##3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 36", + .data = "4#|# 12#|# $ $ $ $ $ @ #|# 5.7 #|15#", +}, { + .pack = "Microban", + .name = "Level 37", + .data = "6 3#|5# #.#|#3 3#.#|#3 $ #.#|# $ $ #|5#@# #|4 #3 #|4 5#", +}, { + .pack = "Microban", + .name = "Level 38", + .data = "10#|#8 #|# ##.3# #|# # $$ . #|# . @$## #|5#4 #|4 6#", +}, { + .pack = "Microban", + .name = "Level 39", + .data = "5#|#3 4#|# # # .#|#4 $ 3#|3# #$. #|#3 #@3 #|# # 6#|#3 #|5#", +}, { + .pack = "Microban", + .name = "Level 40", + .data = " 5#| #3 #|##3 ##|# 3$ #|# .+. #|7#", +}, { + .pack = "Microban", + .name = "Level 41", + .data = "7#|#5 #|#@3$ ##|# #3.#|##4 ##| 6#", +}, { + .pack = "Microban", + .name = "Level 42", + .data = "3 4#|3 # #|3 #@ #|4#$.#|#3 $.#|# # $.#|#4 ##|6#", +}, { + .pack = "Microban", + .name = "Level 43", + .data = "5 4#|5 # @#|5 # #|6# .#|#3 $ .#|# $$# .#|#4 4#|3# #| 4#", +}, { + .pack = "Microban", + .name = "Level 44: Duh!", + .data = "5#|#@$.#|5#", +}, { + .pack = "Microban", + .name = "Level 45", + .data = "6#|#3. #|# $ #|# #$##|# $ #|# @ #|6#", +}, { + .pack = "Microban", + .name = "Level 46", + .data = " 6#|##4 #|# ## #|# # $ #|# * .#|## #@##| #3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 47", + .data = " 7#|3#5 #|# $ $3 #|# 3# 5#|# @ . .3 #|#3 3#3 #|5# 5#", +}, { + .pack = "Microban", + .name = "Level 48", + .data = "6#|# @ #|# # ##|# .# ##|# .3$ #|# .#3 #|4#3 #|3 5#", +}, { + .pack = "Microban", + .name = "Level 49", + .data = "6#|# @ #|# $# #|# $ #|# $ ##|3# 4#| # # #| #3. #| #5 #| 7#", +}, { + .pack = "Microban", + .name = "Level 50", + .data = " 4#|3# 5#|# $ @..#|# $4 # #|3# 4# #| #6 #| 8#", +}, { + .pack = "Microban", + .name = "Level 51", + .data = "4#|# 3#|#4 3#|# $*@ #|3# .# #| #4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 52", + .data = " 4#|3# @#|# $ #|# *.#|# *.#|# $ #|3# #| 4#", +}, { + .pack = "Microban", + .name = "Level 53", + .data = " 5#|##. .##|# * * #|# # #|# $ $ #|## @ ##| 5#", +}, { + .pack = "Microban", + .name = "Level 54", + .data = "6 6#|6 #4 #| 5# . #|3# 3#. #|# $ $ . ##|# @$$ # . #|##4 5#| 6#", +}, { + .pack = "Microban", + .name = "Level 55", + .data = "8#|# @ # #|#6 #|5#$ #|4 # 3#| ## #$ ..#| ## # 3#|4 4#", +}, { + .pack = "Microban", + .name = "Level 56", + .data = "5#|#3 3#|# $ #|##* . #| #3 @#| 6#", +}, { + .pack = "Microban", + .name = "Level 57", + .data = " 4#| # #| #@ #| # #|3# 4#|#4 * #|# $3 #|5#. #|4 4#", +}, { + .pack = "Microban", + .name = "Level 58", + .data = "4#|# 4#|#.*$ #|# .$# #|## @ #| #3 ##| 5#", +}, { + .pack = "Microban", + .name = "Level 59", + .data = "12#|#10 #|# 7# @##|# #9 #|# # $3 # #|# $$ 5# #|3# # # 3.#| 4# #4 #|7 6#", +}, { + .pack = "Microban", + .name = "Level 60", + .data = " 9#| #7 #|##@5# #|# #3 # #|# #3 $.#|# ##$##.#|##$## #.#|#3 $ #.#|#3 # 3#|8#", +}, { + .pack = "Microban", + .name = "Level 61", + .data = "8#|#6 #|# 4# #|# #3.@#|# 3#$3#|# #5 #|# $$ $ #|4#3 ##|3 #.3#|3 3#", +}, { + .pack = "Microban", + .name = "Level 62", + .data = "3 10#|4#4 ## #|# 3$4.$@#|#6 3# #|#3 4# 4#|5#", +}, { + .pack = "Microban", + .name = "Level 63", + .data = "5#3 4#|#3 5# .#|#7 $ 8#|3# 4# .$4 @ #| # # # 4#3 #| 4# 4# 5#", +}, { + .pack = "Microban", + .name = "Level 64", + .data = " 6#|##4 #|#3 $ #|# $$ #|3# .5#| ##.# @ #|3 #. $ #|3 #. 4#|3 4#", +}, { + .pack = "Microban", + .name = "Level 65", + .data = " 6#| #4 #| # $ #| 4#$ #|## $ $ #|#4.# ##|#5 @ #|## #3 #| 8#", +}, { + .pack = "Microban", + .name = "Level 66", + .data = "3 3#|3 #@#| 3#$3#|## . ##|# # # #|# #3 # #|# #3 # #|# #3 # #|# # # #|## $ $ ##| ##. .##| #3 #| #3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 67", + .data = "5#|#3 ##|# # #|#@$*.##|## . #| # $# #| ##3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 68", + .data = " 4#| # 6#|##4 $ #|# .# $3 #|# .#$5#|# .@ #|6#", +}, { + .pack = "Microban", + .name = "Level 69", + .data = "4# 4#|# 4# #|# # # #|# #4 $##|# . .#$ #|#@ ## # $ #|#3 . #3 #|11#", +}, { + .pack = "Microban", + .name = "Level 70", + .data = "5#|# @ 4#|#6 #|# $ $$ #|##$## #|#3 4#|# .. #|##.. #| 3# #|3 4#", +}, { + .pack = "Microban", + .name = "Level 71", + .data = "11#|#5 #3 3#|# $@$ # . .#|# ## 3# ## #|# #7 # #|# #3 #3 # #|# 9# #|#11 #|13#", +}, { + .pack = "Microban", + .name = "Level 72", + .data = " 4#| ## 5#| # $ @ #| # $#3 #|4# 5#|# #3 #|#4 $ #|# ..# #|# .4#|# ##|4#", +}, { + .pack = "Microban", + .name = "Level 73", + .data = "4#|# 5#|# $$ $ #|#6 #|## ## ##|#3.#@#|# 3# ##|#6 #|# #3 #|8#", +}, { + .pack = "Microban", + .name = "Level 74", + .data = " 4#| # 7#| #$ @#3 .#|## #$$3 .#|# $ ##..#|#3 # 5#|3#3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 75", + .data = " 7#|## 4.##|#3 6#|#3 $ $ @#|3# $ $ #| 3#4 #|4 6#", +}, { + .pack = "Microban", + .name = "Level 76", + .data = " 5#|##3 #|#4 5#|# #.#3 #|#@ #.# $ #|# #.# ##|#4 # #|## ##$$#| ##5 #| # 4#| 4#", +}, { + .pack = "Microban", + .name = "Level 77", + .data = "10#|# @ 4. #|#3 4#$##|## # $ $ #| # $6 #| #3 6#| 5#", +}, { + .pack = "Microban", + .name = "Level 78", + .data = " 7#|##5 ##|# $ $ #|# $ $ $ #|## 3# 4#| #@ 5.#| ##5 3#| 7#", +}, { + .pack = "Microban", + .name = "Level 79", + .data = " 9#| #4 # #|## $#$# #|# .$.@ #|# .#4 #|10#", +}, { + .pack = "Microban", + .name = "Level 80", + .data = "4#|# 7#|# . ## .#|# $#4 .#|## ## # .#| #4 # #| 4# # #| # @$ 3#| # $$ #| #4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 81", + .data = " 5#| #3 #| # . #|## * #|# *##|# @##|## $ #| #3 #| 5#", +}, { + .pack = "Microban", + .name = "Level 82", + .data = "5#|#3 3#|# .3 ##|##*#$ #|# .# $ #|# @## ##|#5 #|7#", +}, { + .pack = "Microban", + .name = "Level 83", + .data = "6#|#4 ##|# $ $ ##|## $$ #| # #3 #| # ## ##| # . .#| # @. .#| # 4#| 4#", +}, { + .pack = "Microban", + .name = "Level 84", + .data = "8#|# 3. #|# 3# ##|# # $ #|## #@$ #| # # $ #| # 3# 5#| #9 #| #3 3#3 #| 5# 5#", +}, { + .pack = "Microban", + .name = "Level 85", + .data = "7 4#| 7# #| # $6 #| #3 $ $ #| # 8#|## # . #|# # # #|# @ . ##|## # # #| #3 . #| 7#", +}, { + .pack = "Microban", + .name = "Level 86", + .data = "4 4#| 3# ##| ## $3 #|## $ # #|# @#$$ #|# .. 3#|# ..3#|5#", +}, { + .pack = "Microban", + .name = "Level 87", + .data = "5 4#|6# #|#7 #|# 3. .#|##$6#|# $ #|#3 $3#|## $ #| ## @ #| 6#", +}, { + .pack = "Microban", + .name = "Level 88", + .data = "5 4#| # 3# #| # #4 #| # # # #| # #$ #.#| # # # # #| # #$ #.# #|3 # # # #|4#$ #.# #|# @5 # #|#3 # ## #|8#", +}, { + .pack = "Microban", + .name = "Level 89", + .data = "10#|#3 ##3 #|# $ $@# #|4# # $ #|3 #.# ##| # #.# $#| # #.3 #| # #.3 #|3 6#", +}, { + .pack = "Microban", + .name = "Level 90", + .data = " 8#| # @3 #| # $ $ #|3# ## 3#|# $..$ #|#3 ..3 #|10#", +}, { + .pack = "Microban", + .name = "Level 91", + .data = "11#|#4 .## #|# $$@..$$ #|#3 ##.3 #|11#", +}, { + .pack = "Microban", + .name = "Level 92", + .data = " 4#| # #4 5#| # #4 #3 #| # 6#.# #|4# $4 . #|#3 $$# 3#.# #|#3 #3 # #3 #|9# #@ ##|10 # #|10 4#", +}, { + .pack = "Microban", + .name = "Level 93", + .data = " 9#|##3 #3 ##|#4 #4 #|# $ # $ #|#3 *.*3 #|4#.@.4#|#3 *.*3 #|# $ # $ #|#4 #4 #|##3 #3 ##| 9#", +}, { + .pack = "Microban", + .name = "Level 94", + .data = "9#|# @ #3 #|# $ $3 #|##$3# ##|# 3. #|#3 #3 #|6# #|5 4#", +}, { + .pack = "Microban", + .name = "Level 95", + .data = "8#|#@5 #|# .$$. #|# $..$ #|# $..$ #|# .$$. #|#6 #|8#", +}, { + .pack = "Microban", + .name = "Level 96", + .data = " 6#| #4 #| #4 #|5# #|#3 #.5#|#3 $@$3 #|5#.#3 #|3 ## ## ##|3 #3 $.#|3 #3 3#|3 5#", +}, { + .pack = "Microban", + .name = "Level 97", + .data = "3 4#|3 # 8#|4# $ $5.#|#3 $3 6#|#@3# 3#|# $ #|# $ # #|## # #| #4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 98", + .data = "5#|#3 ## 4#|# $ 3# .#|# $3 $ .#|## $5#.# 4#|# $ # # .3# #|#4 # # .# @ #|3# # #7 #| 4# ##5 ##|8 7#", +}, { + .pack = "Microban", + .name = "Level 99", + .data = "15 5#|15 #3 #|7# 7# # #|#5 # # #6 #|# @ 4# #5 4#|# #4 4.## 4# #|#4 5# ## $$ $ $ #|6#3 #11 #|9 # 10#|9 4#", +}, { + .pack = "Microban", + .name = "Level 100", + .data = "7#|# @# #|#.$3 #|#. # $##|#.$#3 #|#. # $ #|# #3 #|8#", +}, { + .pack = "Microban", + .name = "Level 101: Lockdown", + .data = " 5#| #3 #| # # 7#| # * #3 #| ## ##3 # #| #5 #* #|3# # # # 3#|# *#$+3 #|# #3 ## ##|#3 # * #|7# # #|6 #3 #|6 5#", +}, { + .pack = "Microban", + .name = "Level 102", + .data = "11#|#4.#4 #|# #3 $$ #|# @ ## #|#5 ##$ #|6# $ #|5 #4 #|5 6#", +}, { + .pack = "Microban", + .name = "Level 103", + .data = " 5#| # . ##|3# $ #|# . $#@#|# #$ . #|# $ 3#|## . #| 5#", +}, { + .pack = "Microban", + .name = "Level 104", + .data = "4 5#|5#3 #|#4 $ #|# $#$#@#|3# #3 #| # 3. #| 3# ##|4 # #|4 4#", +}, { + .pack = "Microban", + .name = "Level 105", + .data = " 4# 4#|## 3# ##|#3 # #3 #|# *. .* #|3#$3 $3#| #3 @3 #|3#$3 $3#|# *. .* #|#3 # #3 #|## 3# ##| 4# 4#", +}, { + .pack = "Microban", + .name = "Level 106", + .data = " 8#| #6 #| #@3 $ #|## 3#$ #|# 5.3#|# $ $ $ #|6# # #|5 #3 #|5 5#", +}, { + .pack = "Microban", + .name = "Level 107", + .data = "8#|#6 #|# $*** #|# * * #|# * * #|# ***. #|#5 @#|8#", +}, { + .pack = "Microban", + .name = "Level 108", + .data = "4#5 5#|# 3#3 #3 ##|#4 #3 #$ $ #|#..# 5# # #|# @4 # $ $ #|#..#9 ##|##3 9#| 5#", +}, { + .pack = "Microban", + .name = "Level 109", + .data = " 7#|# #5 #|# # # # #| # @ $ #|3# 3# #|#3 3# #|# $ ##.#|## $ #.#| ## $ .#|# ## $#.#|## ## #.#|3# #3 #|3# 5#", +}, { + .pack = "Microban", + .name = "Level 110", + .data = " 4#| # #| # $4#|3#. . #|# $ # $ #|# . .3#|4#$ #|3 # @#|3 4#", +}, { + .pack = "Microban", + .name = "Level 111", + .data = "6#|#4 4#|#4 3.#|#4 3.#|6# #| # # #| # $$ ##| # @$ #| # $$ #| ## $# #|3 #4 #|3 6#", +}, { + .pack = "Microban", + .name = "Level 112", + .data = " 5#|##3 4#|# 3$ #|# #3 $ #|#3 $## ##|3# #. #| # #3 #| 5# 3#| #3 # ##| # @4.#| #6 #| #3 # #| 8#", +}, { + .pack = "Microban", + .name = "Level 113", + .data = "3 5#| ##3 #|3# # #|#4 . #|# ## 5#|# . . # ##|# # @ $3 3#|5#. # $ #|4 4# $ #|7 ## $ ##|8 # ##|8 # #|8 4#", +}, { + .pack = "Microban", + .name = "Level 114", + .data = "6#|#4 3#|# # $ #|# $ @ #|## ## 5#|# #6.#|# $ $ $ $ #|##3 6#| 5#", +}, { + .pack = "Microban", + .name = "Level 115", + .data = "4 5#|5#3 4#|#5 #4 #|# #5. #|## ## # 3#| #$$@3$ #| #5 3#| 7#", +}, { + .pack = "Microban", + .name = "Level 116", + .data = "5 5#|3 3#3 #|4#5.#|# @5$ #|#5 # ##|5#3 #|4 5#", +}, { + .pack = "Microban", + .name = "Level 117", + .data = " 4# 4#| # 3# ##| #6 @ #|##..3#3 #|#6 # #|#3.#$ # #|# ## $$ $ #|# $4 3#|4# 3#|3 4#", +}, { + .pack = "Microban", + .name = "Level 118", + .data = " 5#|##3 ##|# $ ##|# $ $ ##|3#$# . ##| # # . #| ## ##. #| # @ . ##| #3 # #| 8#", +}, { + .pack = "Microban", + .name = "Level 119", + .data = " 6#| #4 ##| ## ## #| # $$ # #| # @$ # #| #4 # #|4# # #|# 3. ##|#5 ##|7#", +}, { + .pack = "Microban", + .name = "Level 120", + .data = "6 4#|7# #|# $6 ##|# $5# #|# @# # #|## ##..3 #|# # ..4#|# $ 3#|# $3#|# #|4#", +}, { + .pack = "Microban", + .name = "Level 121", + .data = " 6#| # . #|##$.# #|# * #|# ..3#|##$ # 5#|## ## #3 #|# 4# # #|#3 @ $ $ #|## #5 #| 10#", +}, { + .pack = "Microban", + .name = "Level 122", + .data = "5#|#3 3#|# #$ #|# $3 #|# $ $ #|# $# #|# @3#|## 8#|#6 3.#|#9 #|8#..#|7 4#", +}, { + .pack = "Microban", + .name = "Level 123", + .data = "8#|#6 #|# $ $$ 8#|5# @##. . #|4 #$ # .3 #|4 #3 #. . ##|4 #$# ## # #|4 #8 #|4 # 3# ##|4 # # 4#|4 4#", +}, { + .pack = "Microban", + .name = "Level 124", + .data = "14#|#6 #5 #|# $@$$ # . ..#|## ## 3# ## #| # #7 # #| # #3 #3 # #| # 9# #| #11 #| 13#", +}, { + .pack = "Microban", + .name = "Level 125", + .data = "6 5#|6 #3 ##|6 # $ #|8# #@##|# . # $ $ #|#8 $# #|#3.5#3 #|5#3 5#", +}, { + .pack = "Microban", + .name = "Level 126", + .data = " 11#|##7. #|# 7$@ #|#3 # # # ##|# # #5 #|#3 7#|5#", +}, { + .pack = "Microban", + .name = "Level 127", + .data = "## 4#|4# 4#| # $ $. #|## # .$ #|#3 ##.3#|# $ . #|# @ #3 #|# 6#|4#", +}, { + .pack = "Microban", + .name = "Level 128", + .data = " 9#|3#3 #3 #|# * $ . . #|#3 $ ## ##|4#*#3 #| # @ 3#| #3 3#| 5#", +}, { + .pack = "Microban", + .name = "Level 129", + .data = " 9#|3# @ #3 #|# * $ *.. #|#3 $ #3 #|4#*# 3#| #5 ##| #3 3#| 5#", +}, { + .pack = "Microban", + .name = "Level 130", + .data = "5# 5#|#3 4#.. #|# 3$6 #|#3 $# .. #|3# @# ## #| # ##4 #| 10#", +}, { + .pack = "Microban", + .name = "Level 131", + .data = "5#|#3 #|# . #|#.@.3#|##.# #|# $ #|# $3 #|##$$ #| # 3#| # #| 4#", +}, { + .pack = "Microban", + .name = "Level 132", + .data = "4#|# @3#|#.* 5#|#..#$$ $ #|##7 #| # # ## #| #3 5#| 5#", +}, { + .pack = "Microban", + .name = "Level 133", + .data = " 7#| # . .3#| # . . . #|3# 4# #|# @$ $ #|# $$ $ #|4#3 3#|3 5#", +}, { + .pack = "Microban", + .name = "Level 134", + .data = "8 4#|9# #|#3 ## $3 #|# $3 ## #|3# #. .# ##| # #. .#$##| # #3 # #| # @ $4 #| # 7#| 4#", +}, { + .pack = "Microban", + .name = "Level 135", + .data = "7#|#5 5#|# $$#@##..#|# #7 #|# $ # # #|4# $ ..#|3 8#", +}, { + .pack = "Microban", + .name = "Level 136", + .data = " 7#| #5 #|## 3#$##|#.$3 @ #|# .. #$ #|#.## $ #|#4 4#|6#", +}, { + .pack = "Microban", + .name = "Level 137", + .data = "7 4#|6 ## 3#|4# # $ #|# 4# $ $ #|#3 ..# #$ #|# #3 @ 3#|## #..# 3#| # ## # #| #6 #| 8#", +}, { + .pack = "Microban", + .name = "Level 138", + .data = " 4#|3# #|#4 3#|# # . .#|# @ 3.4#|# # # #3 ##|#3 # $$3 #|5# $ $ #|4 ##$ # ##|5 #4 #|5 6#", +}, { + .pack = "Microban", + .name = "Level 139", + .data = " 4#|## 4#|#3 3.#|#3 3.#|#3 # ##|#3 #@ 4# 4#|5# $3 3# #|4 # ##$ $3 #|3 3#5 $$ #|3 # $ ##3 3#|3 #4 6#|3 6#", +}, { + .pack = "Microban", + .name = "Level 140", + .data = "8# 5#|# #3 3#3 #|#6 ## $ #|#.# @ ## $ ##|#.#3 # $ ##|#.#4 $ ##|#. ## 5#|##4 #| 6#", +}, { + .pack = "Microban", + .name = "Level 141", + .data = " 8#| # # . #| #3 .*.#| # # * #|4#$##.##|#6 $ #|# $ ## $ #|#3 @#3 #|10#", +}, { + .pack = "Microban", + .name = "Level 142", + .data = " 4#| # #| # 4#|3#$.$ #|# .@. #|# $.$3#|4# #|3 # #|3 4#", +}, { + .pack = "Microban", + .name = "Level 143", + .data = "4#|# 4#|# $3 #|# .# #|# $# ##|# . #|4# #|3 # #| 3# 3#| # $ #|## #$# ##|# $ @ $ #|# ..#.. #|3#3 3#| 5#", +}, { + .pack = "Microban", + .name = "Level 144", + .data = "3 4#| 3# 5#| # $$ #3 #| # $ . .$$##| # .. #. $ #|3# #** . #|# . **# 3#|# $ .# .. #|##$$.@. $ #| #3 # $$ #| 5# 3#|5 4#", +}, { + .pack = "Microban", + .name = "Level 145", + .data = "3 5#|3 # @ #| ##3 ##|3#.3$.3#|# $3.$ #|# $.#.$ #|# $3.$ #|3#.3$.3#| ##3 ##|3 #3 #|3 5#", +}, { + .pack = "Microban", + .name = "Level 146", + .data = " 7#|## . ##|# .3$. #|# $. .$ #|#.$ @ $.#|# $. .$ #|# .3$. #|## . ##| 7#", +}, { + .pack = "Microban", + .name = "Level 147: reduction of (Mas Sasquatch 8)", + .data = "7 5#|8#3 #|#.3 . @#.#|# 3#5 #|## $ #4 #| # $3 5#| # $# #| ## # #| #3 ##| 5#", +}, { + .pack = "Microban", + .name = "Level 148: from (Original 18)", + .data = "11#|# . #3 #|# #. @3 #|# #..# 7#|## ## $$ $ $ #| ##11 #| 13#", +}, { + .pack = "Microban", + .name = "Level 149: from (Boxxle 43)", + .data = " 4#|## 3#|#@$3 #|3# $ #| # 6#| # $4.#| # # 4#| ## # #| # $# #| #4 #| # 3#| 4#", +}, { + .pack = "Microban", + .name = "Level 150: from (Original 47)", + .data = "5 4#| 5# #| #5 $7#|## ## ..# 3.#|# $ $$#$ @3 #|#8 3# #|7# # 4#|6 4#", +}, { + .pack = "Microban", + .name = "Level 151: from (Original 47)", + .data = "3 4#|3 # #| 3# #|## $ #|#3 # #|# #$$ 6#|# #3 #3 .#|# $ @3 .#|3# 4#..#| 4# 4#", +}, { + .pack = "Microban", + .name = "Level 152: reduced (Mas Sasquatch 23)", + .data = "6# 4#|#5 #4 #|#.## #$## #|#3 #5 # #|#$ # 3# # #|# #6 # # #|# # 4# # # #|#. @4 $ * . #|15#", +}, { + .pack = "Microban", + .name = "Level 153: reduction of (Revenge 306)", + .data = "13#|#.# @# #3 #|#.#$$3 # $ #|#.# # $#3 #|#.# $# # $##|#.# # $# #|#.# $# # $#|#.. # $3 #|#.. # # #|12#", +}, { + .pack = "Microban", + .name = "Level 154: Take the long way home.", + .data = " 28#| #26 #| # 24# #| # #22 # #| # # 20# # #| # # #18 # # #| # # # 16# # # #| # # # #14 # # # #| # # # # 12# # # # #| # # # # #12 # # # #| # # # # # 12# # # #| # # # # #14 # # #| # # # # 16# # #| # # # #18 # #|##$# # 20# #|#. @ #22 #|29#", +}, { + .pack = "Microban", + .name = "Level 155: The Dungeon", + .data = "4 6#15 4#|5#*# 17# ##|#3 3#22 #|#8 8# 4# ## #|3# 4#5 # 4# 4# ##|#*# # .# # # #5 #5 #3 #|#*# # #5 # ## # ## ## #|3#4 3# 3# # ## # ## ##| #3 # #*#6 #5 # #4 #| #3 # 3# 5# 4# #4 #| 5#3 5# 7# 6#| #3 # # #**#15 #|## # #3 #**# 7# ## #|#4 9# #4 5# 3#|# #13 # $8 #*#|#3 9# 3# @5# #*#|5#7 4# 4#3 6#", +}, { + .pack = "", + .name = "", + .data = "", +}}; +#define NUM_LEVELS (sizeof(LEVELS) / sizeof(level_t)) static char print_buf[(SOK_LEVEL_MAX_WIDTH + 1) * SOK_LEVEL_MAX_HEIGHT + 1]; static bool on_size( - const sok_ctx_t * const ctx, + const sok_ctx_t * const ctx, const sok_pos_t size, void * const data ) { @@ -37,7 +682,7 @@ on_size( static bool on_home( - const sok_ctx_t * const ctx, + const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_goal, void * const data @@ -49,7 +694,7 @@ on_home( static bool on_wall( - const sok_ctx_t * const ctx, + const sok_ctx_t * const ctx, const sok_pos_t pos, void * const data ) { @@ -61,7 +706,7 @@ on_wall( static bool on_goal( - const sok_ctx_t * const ctx, + const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_player, const bool has_box, @@ -75,7 +720,7 @@ on_goal( static bool on_box( - const sok_ctx_t * const ctx, + const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_goal, void * const data @@ -114,7 +759,7 @@ int main(int argc, char *argv[]) { sok_ctx_t ctx; sok_ctx_init(&ctx, NULL); - if (!sok_ctx_set_level(&ctx, LEVELS[level])) { + if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { fprintf(stderr, "Couldn't load level %zu\n", level); return EXIT_FAILURE; } @@ -122,6 +767,7 @@ int main(int argc, char *argv[]) { char buf[1024]; bool done = false; while (!done) { + printf("%s: %s (#%zu)\n", LEVELS[level].pack, LEVELS[level].name, level); print_level(&ctx); printf("%zu%s> ", ctx.num_moves, sok_ctx_is_done(&ctx) ? " (won!)" : ""); @@ -171,7 +817,7 @@ int main(int argc, char *argv[]) { level = (level + 1) % NUM_LEVELS; // load next level - if (!sok_ctx_set_level(&ctx, LEVELS[level])) { + if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { fprintf(stderr, "Couldn't load level %zu\n", level); return EXIT_FAILURE; } @@ -180,6 +826,16 @@ int main(int argc, char *argv[]) { } break; + CASE_DIGIT + { + level = atoi(buf) % NUM_LEVELS; + + // load level + if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { + fprintf(stderr, "Couldn't load level %zu\n", level); + return EXIT_FAILURE; + } + } default: // ignore break; |