1#
2#   Copyright 2005,2010 by Mark Weyer
3#   Modified 2006 by Mark Weyer
4#   Maintenance modifications 2006,2008,2011 by the cuyo developers
5#
6#   This program is free software; you can redistribute it and/or modify
7#   it under the terms of the GNU General Public License as published by
8#   the Free Software Foundation; either version 2 of the License, or
9#   (at your option) any later version.
10#
11#   This program is distributed in the hope that it will be useful,
12#   but WITHOUT ANY WARRANTY; without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#   GNU General Public License for more details.
15#
16#   You should have received a copy of the GNU General Public License
17#   along with this program; if not, write to the Free Software
18#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19#
20
21Zahn={
22  name="Teeth"
23  author="Mark Weyer"
24  numexplode=6
25  toptime=100
26  pics=Zahn
27  greypic=Grau
28  startpic=Start
29  startdist="**********","**********","**********"
30  bgcolor=0,0,0
31  chaingrass=0
32  topcolor=255,255,170
33  textcolor=204,204,136
34  randomgreys[1]=100
35  neighbours=<neighbours_eight>
36
37  <<
38
39    var oben,unten,links,rechts,obenlinks,
40        untenlinks,obenrechts,untenrechts,
41        zwischenablage;
42
43    Drehen = {
44      zwischenablage = oben;
45      oben = obenlinks;
46      obenlinks = links;
47      links = untenlinks;
48      untenlinks = unten;
49      unten = untenrechts;
50      untenrechts = rechts;
51      rechts = obenrechts;
52      obenrechts = zwischenablage;
53    };
54
55    Dreh_vor = {Drehen; Drehen;};
56
57    Dreh_zufaellig = {
58      if 1:2 -> {Dreh_vor; Dreh_vor;};
59      if 1:2 -> Dreh_vor;
60      if 1:2 -> Drehen;
61    };
62
63    Zahn = {
64      switch {
65        turn==0 -> {
66          file = 2*behaviour.goalblob;
67          qu=Q_TL;
68          if links
69            -> if ??????1? && rechts@(-1,0) -> pos=2 else pos=1
70            else pos=0;
71          if oben
72            -> {if 1??????? && unten@(0,-1) -> pos+=6 else pos+=3;};
73          if obenlinks
74            -> {if ???????1 && untenrechts@(-1,-1) -> pos+=18 else pos+=9;};
75          *;
76          qu=Q_TR;
77          if rechts
78            -> if ??1????? && links@(1,0) -> pos=2 else pos=1
79            else pos=0;
80          if oben
81            -> {if 1??????? && unten@(0,-1) -> pos+=6 else pos+=3;};
82          if obenrechts
83            -> {if ?1?????? && untenlinks@(1,-1) -> pos+=18 else pos+=9;};
84          *;
85          qu=Q_BL;
86          if links
87            -> if ??????1? && rechts@(-1,0) -> pos=2 else pos=1
88            else pos=0;
89          if unten
90            -> {if ????1??? && oben@(0,1) -> pos+=6 else pos+=3;};
91          if untenlinks
92            -> {if ?????1?? && obenrechts@(-1,1) -> pos+=18 else pos+=9;};
93          *;
94          qu=Q_BR;
95          if rechts
96            -> if ??1????? && links@(1,0) -> pos=2 else pos=1
97            else pos=0;
98          if unten
99            -> {if ????1??? && oben@(0,1) -> pos+=6 else pos+=3;};
100          if untenrechts
101            -> {if ???1???? && obenlinks@(1,1) -> pos+=18 else pos+=9;};
102          *;
103        };
104        turn==1 -> {
105          file=1;
106          qu=Q_TL;
107          if rechts -> pos=1 else pos=0;
108          if obenrechts -> pos+=2;
109          if obenlinks -> pos+=4;
110          if oben -> pos+=8;
111          *;
112          qu=Q_TR;
113          if rechts -> pos=1 else pos=0;
114          if obenrechts -> pos+=2;
115          if untenrechts -> pos+=4;
116          if unten -> pos+=8;
117          *;
118          qu=Q_BL;
119          if links -> pos=1 else pos=0;
120          if untenlinks -> pos+=2;
121          if obenlinks -> pos+=4;
122          if oben -> pos+=8;
123          *;
124          qu=Q_BR;
125          if links -> pos=1 else pos=0;
126          if untenlinks -> pos+=2;
127          if untenrechts -> pos+=4;
128          if unten -> pos+=8;
129          *;
130        };
131        turn==2 -> {
132          file=1;
133          qu=Q_TL;
134          if links -> pos=17 else pos=16;
135          if obenrechts -> pos+=2;
136          if obenlinks -> pos+=4;
137          if oben -> pos+=8;
138          *;
139          qu=Q_TR;
140          if rechts -> pos=17 else pos=16;
141          if obenrechts -> pos+=2;
142          if untenrechts -> pos+=4;
143          if oben -> pos+=8;
144          *;
145          qu=Q_BL;
146          if links -> pos=17 else pos=16;
147          if untenlinks -> pos+=2;
148          if obenlinks -> pos+=4;
149          if unten -> pos+=8;
150          *;
151          qu=Q_BR;
152          if rechts -> pos=17 else pos=16;
153          if untenlinks -> pos+=2;
154          if untenrechts -> pos+=4;
155          if unten -> pos+=8;
156          *;
157        };
158      };
159    };
160
161    Zahn.turn = {Dreh_vor;};
162
163    Zahn.connect = {
164      inhibit=0;
165      if !links -> inhibit+=DIR_L;
166      if !rechts -> inhibit+=DIR_R;
167      if !oben -> inhibit+=DIR_U;
168      if !unten -> inhibit+=DIR_D;
169      if !obenlinks -> inhibit+=DIR_UL;
170      if !obenrechts -> inhibit+=DIR_UR;
171      if !untenlinks -> inhibit+=DIR_DL;
172      if !untenrechts -> inhibit+=DIR_DR;
173    };
174
175    Init_drei = {
176      oben=1;
177      links=1;
178      untenrechts=1;
179      Dreh_zufaellig;
180    };
181
182    Start.init = {
183      kind=Zahn;
184      behaviour.+=goalblob;
185      Init_drei;
186    };
187
188    Zahn.init = {
189      oben = 1; Dreh_zufaellig;
190      oben = 1; Dreh_zufaellig;
191      oben = 1; Dreh_zufaellig;
192      oben = 1; Dreh_zufaellig;
193    };
194
195    Grau.init = {
196      kind=Zahn;
197      Init_drei;
198    };
199
200  >>
201
202  Zahn = {pics=mzZahn.xpm, mzZahnDreh.xpm, mzZahnGras.xpm}
203  Grau = {}
204  Start = {}
205
206}
207
208