progs/knight.scala
changeset 1 b595d654cb2d
parent 0 02f53f76f828
child 2 e0ec73c462c7
--- a/progs/knight.scala	Mon Oct 31 10:28:32 2016 +0000
+++ b/progs/knight.scala	Mon Oct 31 10:41:23 2016 +0000
@@ -18,8 +18,8 @@
   0 <= x._1 && 0 <= x._2 && x._1 < n && x._2 < n
 
 def moves(n: Int)(x: (Int, Int)): List[(Int, Int)] = {
-  Set((1, 2),(2, 1),(2, -1),(1, -2),
-      (-1, -2),(-2, -1),(-2, 1),(-1, 2)).map(add_pair(x)).filter(is_legal(n))
+  List((1, 2),(2, 1),(2, -1),(1, -2),
+       (-1, -2),(-2, -1),(-2, 1),(-1, 2)).map(add_pair(x)).filter(is_legal(n))
 }
 
 def tour(n: Int)(steps: List[(Int, Int)]): Unit = {