| 
85
 | 
     1  | 
  | 
| 
 | 
     2  | 
import scala.concurrent._
  | 
| 
 | 
     3  | 
import scala.concurrent.duration._
  | 
| 
 | 
     4  | 
import ExecutionContext.Implicits.global
  | 
| 
 | 
     5  | 
import scala.language.postfixOps 
  | 
| 
 | 
     6  | 
  | 
| 
 | 
     7  | 
lazy val f = Future {
 | 
| 
 | 
     8  | 
  assert(legal_moves(8, Nil, (2,2)) == 
  | 
| 
 | 
     9  | 
             List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
  | 
| 
 | 
    10  | 
  assert(legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
  | 
| 
 | 
    11  | 
  assert(legal_moves(8, List((4,1), (1,0)), (2,2)) == 
  | 
| 
 | 
    12  | 
             List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
  | 
| 
 | 
    13  | 
  assert(legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
  | 
| 
 | 
    14  | 
  assert(legal_moves(1, Nil, (0,0)) == List())
  | 
| 
 | 
    15  | 
  assert(legal_moves(2, Nil, (0,0)) == List())
  | 
| 
 | 
    16  | 
  assert(legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
  | 
| 
 | 
    17  | 
}
  | 
| 
 | 
    18  | 
  | 
| 
 | 
    19  | 
Await.result(f, 120 second)
  |