1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System
1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-
1_2.dtd'
>
4 <declaration>// Place global declarations here.
12 typedef int[
0, N-
1] id_c;
14 broadcast chan up[N], down[N], left[N], right[N], start, leftRed, rightRed;
18 bool grid[
6][
6];
</declaration>
20 <name x=
"5" y=
"5">HorzCar
</name>
21 <parameter>int[
2,
3] length, const id_c id, int[
0,
4] x, const int[
0,
5] y
</parameter>
22 <declaration>// Place local declarations here.
26 for (i=
0; i
<length; i++) {
30 <location id=
"id0" x=
"-425" y=
"-51">
32 <location id=
"id1" x=
"-535" y=
"-136">
35 <location id=
"id2" x=
"-212" y=
"-76">
41 <label kind=
"synchronisation" x=
"-407" y=
"-80">start?
</label>
46 <label kind=
"synchronisation" x=
"-517" y=
"-110">reg!
</label>
47 <label kind=
"assignment" x=
"-517" y=
"-93">register()
</label>
52 <label kind=
"guard" x=
"-280" y=
"8">x
>0 && !grid[x-
1][y]
</label>
53 <label kind=
"synchronisation" x=
"-246" y=
"102">left[id]!
</label>
54 <label kind=
"assignment" x=
"-340" y=
"34">grid[x+length-
1][y]:=false,
57 <nail x=
"-306" y=
"8"/>
58 <nail x=
"-136" y=
"0"/>
63 <label kind=
"guard" x=
"-306" y=
"-263">x+length
< 6 && !grid[x+length][y]
</label>
64 <label kind=
"synchronisation" x=
"-221" y=
"-204">right[id]!
</label>
65 <label kind=
"assignment" x=
"-331" y=
"-229">grid[x][y]:=false,
66 grid[x+length][y]:=true,
68 <nail x=
"-323" y=
"-102"/>
69 <nail x=
"-195" y=
"-178"/>
70 <nail x=
"-110" y=
"-102"/>
75 <parameter>int[
2,
3] length, const id_c id, const int[
0,
5] x, int[
0,
4] y
</parameter>
76 <declaration>void register() {
78 for(i=
0; i
<length; i++){
83 <location id=
"id3" x=
"-314" y=
"-34">
85 <location id=
"id4" x=
"-416" y=
"-76">
88 <location id=
"id5" x=
"-102" y=
"-34">
94 <label kind=
"synchronisation" x=
"-228" y=
"-72">start?
</label>
99 <label kind=
"synchronisation" x=
"-374" y=
"-110">reg!
</label>
100 <label kind=
"assignment" x=
"-374" y=
"-76">register()
</label>
101 <nail x=
"-255" y=
"-85"/>
106 <label kind=
"guard" x=
"-170" y=
"153">y
>0 && !grid[x][y-
1]
</label>
107 <label kind=
"synchronisation" x=
"-119" y=
"119">down[id]!
</label>
108 <label kind=
"assignment" x=
"-221" y=
"51">grid[x][y-
1]:=true,
109 grid[x][y+length-
1]:=false,
111 <nail x=
"-153" y=
"42"/>
112 <nail x=
"-34" y=
"42"/>
117 <label kind=
"guard" x=
"-204" y=
"-221">y+length
< 6 && !grid[x][y+length]
</label>
118 <label kind=
"synchronisation" x=
"-127" y=
"-195">up[id]!
</label>
119 <label kind=
"assignment" x=
"-263" y=
"-161">grid[x][y+length]:=true,
122 <nail x=
"-178" y=
"-102"/>
123 <nail x=
"-34" y=
"-102"/>
128 <declaration>int[
0,N] registered;
129 bool done =
0;
</declaration>
130 <location id=
"id6" x=
"-493" y=
"-255">
132 <location id=
"id7" x=
"-680" y=
"-246">
134 <location id=
"id8" x=
"-799" y=
"-246">
140 <label kind=
"synchronisation" x=
"-629" y=
"-272">finish?
</label>
141 <label kind=
"assignment" x=
"-662" y=
"-250">done :=
1</label>
146 <label kind=
"guard" x=
"-781" y=
"-280">registered == N
</label>
147 <label kind=
"synchronisation" x=
"-781" y=
"-263">start!
</label>
152 <label kind=
"synchronisation" x=
"-875" y=
"-365">reg?
</label>
153 <label kind=
"assignment" x=
"-926" y=
"-382">registered := registered+
1</label>
154 <nail x=
"-892" y=
"-263"/>
155 <nail x=
"-833" y=
"-331"/>
156 <nail x=
"-765" y=
"-314"/>
161 <parameter>const id_c id, int[
0,
5] x
</parameter>
162 <declaration>void register() {
166 <location id=
"id9" x=
"42" y=
"136">
169 <location id=
"id10" x=
"59" y=
"-238">
172 <location id=
"id11" x=
"493" y=
"-51">
174 <location id=
"id12" x=
"51" y=
"-59">
176 <location id=
"id13" x=
"-93" y=
"-68">
178 <location id=
"id14" x=
"-204" y=
"-68">
181 <branchpoint id=
"id15" x=
"187" y=
"-85">
187 <label kind=
"guard" x=
"67" y=
"38">x
<=
0 || grid[x-
1][
3]
</label>
193 <label kind=
"guard" x=
"93" y=
"-187">x+
2 >=
6 || grid[x+
2][
3]
</label>
194 <nail x=
"102" y=
"-127"/>
199 <label kind=
"guard" x=
"-136" y=
"-161">x+
2 < 6 && !grid[x+
2][
3]
</label>
200 <label kind=
"synchronisation" x=
"-68" y=
"-144">rightRed!
</label>
201 <label kind=
"assignment" x=
"-85" y=
"-212">grid[x][
3]:=false,
208 <label kind=
"guard" x=
"-144" y=
"-25">x
> 0 && !grid[x-
1][
3]
</label>
209 <label kind=
"synchronisation" x=
"-93" y=
"0">leftRed!
</label>
210 <label kind=
"assignment" x=
"-144" y=
"25">grid[x+
1][
3]:=false,
217 <label kind=
"probability" x=
"127" y=
"34">1</label>
222 <label kind=
"probability" x=
"178" y=
"-127">3</label>
231 <label kind=
"guard" x=
"416" y=
"-93">x ==
4</label>
232 <label kind=
"synchronisation" x=
"416" y=
"-76">finish!
</label>
237 <label kind=
"synchronisation" x=
"-75" y=
"-80">start?
</label>
242 <label kind=
"synchronisation" x=
"-186" y=
"-85">reg!
</label>
243 <label kind=
"assignment" x=
"-186" y=
"-68">register()
</label>
246 <system>// Place template instantiations here.
252 V1 = VertCar(
2,
1,
4,
3);
253 V2 = VertCar(
3,
2,
5,
2);
254 system RED, V1, V2, Player;
256 // Intermediate puzzle
258 H1 = HorzCar(
2,
0,
0,
5);
259 H2 = HorzCar(
2,
1,
2,
5);
260 V3 = VertCar(
2,
2,
4,
4);
261 V4 = VertCar(
2,
3,
2,
3);
262 V5 = VertCar(
3,
4,
5,
2);
263 V6 = VertCar(
2,
5,
1,
3);
264 H7 = HorzCar(
2,
6,
3,
4);
265 RED = RedCar(
7,
2); //RED
266 V9 = VertCar(
3,
8,
0,
0);
267 HA = HorzCar(
2,
9,
1,
0);
268 VB = VertCar(
2,
10,
3,
0);
269 HC = HorzCar(
2,
11,
4,
1);
270 HD = HorzCar(
2,
12,
4,
0);
271 system H1, H2, V3, V4, V5, V6, H7, RED, V9, HA, VB, HC, HD, Player;
276 H1 = HorzCar(
2,
0,
0,
5);
277 V2 = VertCar(
2,
1,
2,
4);
278 V3 = VertCar(
3,
2,
3,
3);
279 V4 = VertCar(
3,
3,
0,
2);
280 H5 = HorzCar(
2,
4,
1,
3);
281 H6 = HorzCar(
3,
5,
1,
2);
282 H7 = HorzCar(
3,
6,
3,
0);
283 system H1, V2, V3, V4, H5, H6, H7
288 <formula>E
<> Player.done ==
1