pre_marking4/knight1_test2.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 08 Nov 2021 00:17:50 +0000
changeset 400 e48ea8300b2d
parent 386 e2170c91a9f2
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
386
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
import CW9a._
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
assert(legal_moves(8, Nil, (2,2)) == 
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
             List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
assert(legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
assert(legal_moves(8, List((4,1), (1,0)), (2,2)) == 
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
       List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
assert(legal_moves(8, Nil, (0,1)) == List((1,3), (2,2), (2,0)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
assert(legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
assert(legal_moves(1, Nil, (0,0)) == Nil)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
assert(legal_moves(2, Nil, (0,0)) == Nil)
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
assert(legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
e2170c91a9f2 added marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13