From 9d91f9a175293787de13d03522763ffe2dd4a8cb Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 8 Jan 2019 16:35:29 -0500 Subject: move text levels to separate file, add build* to .gitignore --- .gitignore | 1 + meson.build | 1 + src/text/levels.c | 652 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/text/levels.h | 15 ++ src/text/main.c | 689 +++--------------------------------------------------- 5 files changed, 696 insertions(+), 662 deletions(-) create mode 100644 src/text/levels.c create mode 100644 src/text/levels.h diff --git a/.gitignore b/.gitignore index 5761abc..329215c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.o +build* diff --git a/meson.build b/meson.build index 110e0c0..0bb17be 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,7 @@ sources = [ # text interface executable('sok-text', sources + [ 'src/text/main.c', + 'src/text/levels.c', ], dependencies: []) # text interface diff --git a/src/text/levels.c b/src/text/levels.c new file mode 100644 index 0000000..dc031f8 --- /dev/null +++ b/src/text/levels.c @@ -0,0 +1,652 @@ +#include // bool +#include // atoi() +#include // EXIT_{FAILURE,SUCCESS} +#include +#include "../libsok/sok.h" +#include "levels.h" + +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)) + +const level_t * +levels_get_level(const size_t level) { + return LEVELS + (level % NUM_LEVELS); +} + +size_t +levels_get_num_levels(void) { + return NUM_LEVELS; +} diff --git a/src/text/levels.h b/src/text/levels.h new file mode 100644 index 0000000..79ef494 --- /dev/null +++ b/src/text/levels.h @@ -0,0 +1,15 @@ +#ifndef LEVELS_H +#define LEVELS_H + +#include // size_t + +typedef struct { + char *pack, *name, *data; +} level_t; + +const level_t *levels_get_level(const size_t); + +size_t levels_get_num_levels(void); + +#endif /* LEVELS_H */ + diff --git a/src/text/main.c b/src/text/main.c index de5b5f3..eb8d9b2 100644 --- a/src/text/main.c +++ b/src/text/main.c @@ -3,6 +3,7 @@ #include // EXIT_{FAILURE,SUCCESS} #include #include "../libsok/sok.h" +#include "levels.h" #define UNUSED(a) ((void) (a)) @@ -18,650 +19,10 @@ 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( +print_on_size( const sok_ctx_t * const ctx, const sok_pos_t size, void * const data @@ -681,7 +42,7 @@ on_size( } static bool -on_home( +print_on_home( const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_goal, @@ -693,7 +54,7 @@ on_home( } static bool -on_wall( +print_on_wall( const sok_ctx_t * const ctx, const sok_pos_t pos, void * const data @@ -705,7 +66,7 @@ on_wall( } static bool -on_goal( +print_on_goal( const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_player, @@ -719,7 +80,7 @@ on_goal( } static bool -on_box( +print_on_box( const sok_ctx_t * const ctx, const sok_pos_t pos, const bool has_goal, @@ -730,19 +91,20 @@ on_box( return true; } -static sok_ctx_walk_cbs_t PRINT_CBS = { - .on_size = on_size, - .on_home = on_home, - .on_wall = on_wall, - .on_goal = on_goal, - .on_box = on_box, +static sok_ctx_walk_cbs_t +PRINT_CBS = { + .on_size = print_on_size, + .on_home = print_on_home, + .on_wall = print_on_wall, + .on_goal = print_on_goal, + .on_box = print_on_box, }; static void print_level( const sok_ctx_t * const ctx ) { - // fill buffer + // fill print buffer if (!sok_ctx_walk(ctx, &PRINT_CBS, NULL)) { fprintf(stderr, "Couldn't print level\n"); exit(EXIT_FAILURE); @@ -789,21 +151,22 @@ print_moves( } int main(int argc, char *argv[]) { - size_t level = (argc > 1) ? atoi(argv[1]) : 0; + size_t level_num = (argc > 1) ? atoi(argv[1]) : 0; + const level_t *level = levels_get_level(level_num); // init context sok_ctx_t ctx; sok_ctx_init(&ctx, NULL); - if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { - fprintf(stderr, "Couldn't load level %zu\n", level); + if (!sok_ctx_set_level(&ctx, level->data)) { + fprintf(stderr, "Couldn't load level %zu\n", level_num); return EXIT_FAILURE; } char buf[1024]; bool done = false; while (!done) { - printf("%s: %s (#%zu)\n", LEVELS[level].pack, LEVELS[level].name, level); + printf("%s: %s (#%zu)\n", level->pack, level->name, level_num); print_level(&ctx); printf("%zu%s> ", ctx.num_moves, sok_ctx_is_done(&ctx) ? " (won!)" : ""); @@ -850,11 +213,12 @@ int main(int argc, char *argv[]) { case 'n': if (sok_ctx_is_done(&ctx)) { // advance level - level = (level + 1) % NUM_LEVELS; + level_num++; + level = levels_get_level(level_num); // load next level - if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { - fprintf(stderr, "Couldn't load level %zu\n", level); + if (!sok_ctx_set_level(&ctx, level->data)) { + fprintf(stderr, "Couldn't load level %zu\n", level_num); return EXIT_FAILURE; } } else { @@ -864,11 +228,12 @@ int main(int argc, char *argv[]) { break; CASE_DIGIT { - level = atoi(buf) % NUM_LEVELS; + level_num = atoi(buf) % levels_get_num_levels(); + level = levels_get_level(level_num); // load level - if (!sok_ctx_set_level(&ctx, LEVELS[level].data)) { - fprintf(stderr, "Couldn't load level %zu\n", level); + if (!sok_ctx_set_level(&ctx, level->data)) { + fprintf(stderr, "Couldn't load level %zu\n", level_num); return EXIT_FAILURE; } } -- cgit v1.2.3