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.
10 typedef int[
0,N-
1] id_c;
12 broadcast chan up[N], down[N], left[N], right[N], start;
16 bool grid[
6][
6];
</declaration>
18 <name x=
"5" y=
"5">VertCar
</name>
19 <parameter>int[
2,
3] length, const id_c id, int[
0,
5] x, const int[
0,
4] y
</parameter>
20 <declaration>// Place local declarations here.
24 for (i=
0; i
<length; i++) {
28 <location id=
"id0" x=
"-425" y=
"-51">
30 <location id=
"id1" x=
"-535" y=
"-136">
33 <location id=
"id2" x=
"-212" y=
"-76">
39 <label kind=
"synchronisation" x=
"-407" y=
"-80">start?
</label>
44 <label kind=
"synchronisation" x=
"-517" y=
"-110">reg!
</label>
45 <label kind=
"assignment" x=
"-517" y=
"-93">register()
</label>
50 <label kind=
"guard" x=
"-288" y=
"-68">x
>0 && !grid[x-
1][y]
</label>
51 <label kind=
"synchronisation" x=
"-288" y=
"-51">down[id]!
</label>
52 <label kind=
"assignment" x=
"-288" y=
"-34">x:=x-
1</label>
53 <nail x=
"-306" y=
"8"/>
54 <nail x=
"-136" y=
"0"/>
59 <label kind=
"guard" x=
"-306" y=
"-204">x+length
< 6 && !grid[x+length][y]
</label>
60 <label kind=
"synchronisation" x=
"-314" y=
"-153">up[id]!
</label>
61 <label kind=
"assignment" x=
"-306" y=
"-178">x:=x+
1</label>
62 <nail x=
"-323" y=
"-102"/>
63 <nail x=
"-195" y=
"-178"/>
64 <nail x=
"-110" y=
"-102"/>
69 <parameter>int[
2,
3] length, const id_c id, const int[
0,
4] x, int[
0,
5] y
</parameter>
70 <declaration>void register() {
72 for(i=
0; i
<length; i++){
77 <location id=
"id3" x=
"-314" y=
"-34">
79 <location id=
"id4" x=
"-416" y=
"-76">
82 <location id=
"id5" x=
"-102" y=
"-34">
88 <label kind=
"synchronisation" x=
"-228" y=
"-72">start?
</label>
93 <label kind=
"synchronisation" x=
"-374" y=
"-110">reg!
</label>
94 <label kind=
"assignment" x=
"-374" y=
"-76">register()
</label>
95 <nail x=
"-255" y=
"-85"/>
100 <label kind=
"guard" x=
"-135" y=
"8">y
>0 && !grid[x][y-
1]
</label>
101 <label kind=
"synchronisation" x=
"-135" y=
"25">left[id]!
</label>
102 <label kind=
"assignment" x=
"-135" y=
"42">y:=y-
1</label>
103 <nail x=
"-153" y=
"42"/>
104 <nail x=
"-34" y=
"42"/>
109 <label kind=
"guard" x=
"-160" y=
"-102">y+length
< 6 && !grid[x][y+length]
</label>
110 <label kind=
"synchronisation" x=
"-160" y=
"-85">right[id]!
</label>
111 <label kind=
"assignment" x=
"-160" y=
"-68">y:=y+
1</label>
112 <nail x=
"-178" y=
"-102"/>
113 <nail x=
"-34" y=
"-102"/>
118 <parameter>Template red
</parameter>
119 <declaration>int[
0,N] registered;
</declaration>
120 <location id=
"id6" x=
"-680" y=
"-246">
122 <location id=
"id7" x=
"-799" y=
"-246">
128 <label kind=
"guard" x=
"-781" y=
"-280">registered == N
</label>
129 <label kind=
"synchronisation" x=
"-781" y=
"-263">start!
</label>
134 <label kind=
"synchronisation" x=
"-875" y=
"-365">reg?
</label>
135 <label kind=
"assignment" x=
"-926" y=
"-382">registered := registered+
1</label>
136 <nail x=
"-892" y=
"-263"/>
137 <nail x=
"-833" y=
"-331"/>
138 <nail x=
"-765" y=
"-314"/>
141 <system>// Place template instantiations here.
143 // Intermediate puzzle
144 H1 = HorzCar(
2,
0,
0,
5);
145 H2 = HorzCar(
2,
1,
2,
5);
146 V3 = VertCar(
2,
2,
4,
4);
147 V4 = VertCar(
2,
3,
2,
3);
148 V5 = VertCar(
3,
4,
5,
2);
149 V6 = VertCar(
2,
5,
1,
3);
150 H7 = HorzCar(
2,
6,
3,
4);
151 H8 = HorzCar(
2,
7,
3,
2);
152 V9 = VertCar(
3,
8,
0,
0);
153 HA = HorzCar(
2,
9,
1,
0);
154 VB = VertCar(
2,
10,
3,
0);
155 HC = HorzCar(
2,
11,
4,
1);
156 HD = HorzCar(
2,
12,
4,
0);
157 system H1, H2, V3, V4, V5, V6, H7, H8, V9, HA, VB, HC, HD, Player;
161 H1 = HorzCar(
2,
0,
0,
5);
162 V2 = VertCar(
2,
1,
2,
4);
163 V3 = VertCar(
3,
2,
3,
3);
164 V4 = VertCar(
3,
3,
0,
2);
165 H5 = HorzCar(
2,
4,
1,
3);
166 H6 = HorzCar(
3,
5,
1,
2);
167 H7 = HorzCar(
3,
6,
3,
0);
168 system H1, V2, V3, V4, H5, H6, H7
171 // List one or more processes to be composed into a system.