|
" maze.vim - ein kleines Labyrinth-Spiel für VIM
" (c) by Ingo Blechschmidt
" Son Mai 13 11:24:44 MEST 2001
"
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation; either version 2 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program; if not, write to the Free Software
" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"
" Ingo Blechschmidt
" Arberstraße 5
" 86179 Augsburg
" E-Mail: iblech@web.de, http://www.way.to/uselinux/
" Tel.: +49 / 821 882955
"
"
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
| |