main_testing4/shogun_test2.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 26 Apr 2024 17:36:41 +0100
changeset 487 efad9725dfd8
parent 476 7550c816187a
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
476
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
def urbanmain() = {
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
  import M4._
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
7550c816187a updated
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)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
                         Pawn(4,Wht,(1,1)), Pawn(4,Red,(1,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
                  	 Pawn(3,Wht,(2,1)), Pawn(2,Red,(2,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
                      	 Pawn(2,Wht,(3,1)), Pawn(3,Red,(3,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
              		 Pawn(1,Wht,(5,1)), Pawn(1,Red,(4,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
               		 Pawn(4,Wht,(6,1)), Pawn(3,Red,(6,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
               		 Pawn(3,Wht,(7,1)), Pawn(1,Red,(7,8)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
               		 Pawn(2,Wht,(8,1)), Pawn(3,Red,(8,8))))
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
  val pw_c = Pawn(2, Wht, (4,4))
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
  val pw_d = Pawn(3, Red, (4,4))
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
  assert(all_moves(pw_c, b_init) == 
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
   Set(Pawn(2,Wht,(3,5)), Pawn(2,Wht,(2,4)), Pawn(2,Wht,(3,3)), Pawn(2,Wht,(5,5)),
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
   Pawn(2,Wht,(6,4)), Pawn(2,Wht,(4,6)), Pawn(2,Wht,(4,2)), Pawn(2,Wht,(5,3))))
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
  assert(all_moves(pw_d, b_init) ==
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
   Set(Pawn(3,Red,(4,7)), Pawn(3,Red,(5,2)), Pawn(3,Red,(3,2)), Pawn(3,Red,(1,4)), 
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
       Pawn(3,Red,(6,3)), Pawn(3,Red,(3,6)), Pawn(3,Red,(2,5)), Pawn(3,Red,(2,3)), 
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
       Pawn(3,Red,(4,1)), Pawn(3,Red,(5,6)), Pawn(3,Red,(7,4)), Pawn(3,Red,(6,5))))
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
7550c816187a updated
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
}