main_testing4/knight_test2.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 25 Nov 2022 00:03:15 +0000
changeset 448 db2a3e3287a9
parent 403 ffce7b61b446
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
284
9a04eb6a2291 updated
Christian Urban <urbanc@in.tum.de>
parents: 218
diff changeset
     1
403
ffce7b61b446 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
     2
import M4a._
216
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
218
22705d22c105 updated
Christian Urban <urbanc@in.tum.de>
parents: 216
diff changeset
     4
assert(legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
216
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
assert(legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
218
22705d22c105 updated
Christian Urban <urbanc@in.tum.de>
parents: 216
diff changeset
     6
assert(legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
216
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
assert(legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
assert(legal_moves(1, Nil, (0,0)) == List())
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
assert(legal_moves(2, Nil, (0,0)) == List())
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
assert(legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
8c868feb917b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11