476
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
def urbanmain() = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
import M4._
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
val b_init = Board(Set(King(2,Wht,(4,1)), King(1,Red,(5,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
Pawn(4,Wht,(1,1)), Pawn(4,Red,(1,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
Pawn(3,Wht,(2,1)), Pawn(2,Red,(2,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
Pawn(2,Wht,(3,1)), Pawn(3,Red,(3,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
Pawn(1,Wht,(5,1)), Pawn(1,Red,(4,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
Pawn(4,Wht,(6,1)), Pawn(3,Red,(6,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
Pawn(3,Wht,(7,1)), Pawn(1,Red,(7,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
Pawn(2,Wht,(8,1)), Pawn(3,Red,(8,8))))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
val pw_a = Pawn(4, Wht, (4,4))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
assert(eval(pw_a, U, 4, b_init) == Set(Pawn(4,Wht,(4,8))))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
assert(eval(pw_a, U, 3, b_init) == Set(Pawn(4,Wht,(4,7))))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
assert(eval(pw_a, RU, 4, b_init) == Set(Pawn(4,Wht,(6,6)), Pawn(4,Wht,(4,8)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
Pawn(4,Wht,(5,7)), Pawn(4,Wht,(7,5)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
Pawn(4,Wht,(8,4))))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
val pw_b = Pawn(4, Red, (4,4))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
println(eval(pw_b, RU, 4, b_init) == Set(Pawn(4,Red,(8,4)), Pawn(4,Red,(7,5)),
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
Pawn(4,Red,(6,6)), Pawn(4,Red,(5,7))))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
}
|