Name="Ein Labyrinth in vim"
Stich="Labyrinth Maze vim Makro so source"
Zeit="Sam Jun 16 12:39:56 MEST 2001"
Kurz="Viele behaupten, vim könne alles - Ein kleines Spiel kann es auf
jeden Fall, wie dieser Artikel zeigt."
Lang="
Ich habe ein Makro programmiert, speichern Sie es ersteinmal ab (Tar-Bzip2-Archiv oder Tar-Gzip-Archiv):
`exCodes maze.txt`
#########################
#k * #
########### ##################### #
# * # # * # #
# ##### ####### # #### # # # ## # #
# # # * # # # # #
## # # ####### # ## # # # ## #*#
# # # ####### # # # # # * # #
### # # * # # # ## # # # #
# * # ####### # ###### # #### # #
# ###### * # * # # #
# # ##### #### # ######### ## #
# ## ###*# # * # * # # #
# ## ### # ##### #### # ##### # ## #
# ## ### # # # # # # #
# ## *# ### ##### # ## # # # ## # #
#*#### * # # # # # #
# ################## # #### ###### #
# # * * # * ## #
# # # ### ##### ######### ### # # #
# # # # ## # # # ##* #### #
# # ###### # *##### # ### # * #
# # # # # # ##### ####
# # # ######## # # # #*###
# # #### # # ##### # # ####
# # ## # # #### ##### # # # #
# #*# # ## # # ##### #### #
# # ######### # ## # # # # #
# # ##### # # # # #### ### ## #*#
# # # # # # # ### ### # # # #
# # # # # # # # # # # # #### #
# # # # # # ### ### ##### # ##~# #
# # # # * # # ### # #
# ################################ #
# * #
####################################
`exCodee`
`exCodes maze.vim`
" maze.vim - ein kleines Labyrinth-Spiel für VIM
" (c) by Ingo Blechschmidt
" Son Mai 13 11:24:44 MEST 2001
`cat gpl.lic | sed -e 's/#/\"/g'`
`cat add.lic | sed -e 's/#/\"/g'`
split ~/maze.txt
syn clear
syn match wall "#"
syn match stern "*"
syn match spieler "ö"
syn match ziel "\~"
hi wall ctermfg=blue
hi stern ctermfg=red
hi spieler ctermfg=yellow
hi ziel ctermfg=green
let punkte = 0
noremap l :echo Rechts()<CR>
noremap h :echo Links()<CR>
noremap j :echo Unten()<CR>
noremap k :echo Oben()<CR>
noremap q :echo Ende()<CR>
noremap s gg/k<CR>rö
norm s
function Ende()
mapc
quit!
" = clo!
endf
fu CharA()
let aline = getline(".")
let acol = aline[virtcol(".") - 1]
echo acol
return acol
endf
fu Gewonnen()
echo "Du hast gewonnen, herzlichen Glückwunsch!"
cal Ende()
endf
fu Punt()
return "Punkte: " . g:punkte
endf
fu Rechts()
norm! l
let mcol = CharA()
norm! h
if mcol == " "
norm! r lrö
elsei mcol == "*"
norm! r lrö
let g:punkte = g:punkte + 1
elsei mcol == "~"
norm! r lrö
cal Gewonnen()
en
return Punt()
endf
fu Links()
norm! h
let mcol = CharA()
norm! l
if mcol == " "
norm! r hrö
elsei mcol == "*"
norm! r hrö
let g:punkte = g:punkte + 1
elsei mcol == "~"
norm! r hrö
cal Gewonnen()
en
return Punt()
endf
fu Unten()
norm! j
let mcol = CharA()
norm! k
if mcol == " "
norm! r jrö
elsei mcol == "*"
norm! r jrö
let g:punkte = g:punkte + 1
elsei mcol == "~"
norm! r jrö
cal Gewonnen()
en
return Punt()
endf
fu Oben()
norm! k
let mcol = CharA()
norm! j
if mcol == " "
norm! r krö
elsei mcol == "*"
norm! r krö
let g:punkte = g:punkte + 1
elsei mcol == "~"
norm! r krö
cal Gewonnen()
en
return Punt()
endf
`exCodee`
Nun starten Sie mal das Spiel mit$esCodes :cd maze<CR>:so
maze.vim$esCodee (q steht für Quit).
Das bringt wohl den Beweis... Die Farben wurden mittels Syntax-Highligthing
realisiert, die Steuerung mittels mehreren $esCodes :map$esCodee Aufrufen.
"
case $1 in
Name) echo $Name; exit;;
Stich) echo $Stich; exit;;
Zeit) echo $Zeit; exit;;
Kurz) echo $Kurz; exit;;
Lang) echo $Lang; exit;;
esac
# if [ "$1" = "Name" ]; then echo $Name; fi
mself_vA="txt/0029.txt"