Skip to content

Instantly share code, notes, and snippets.

@machisuji
Created January 25, 2012 12:26
Show Gist options
  • Select an option

  • Save machisuji/1676039 to your computer and use it in GitHub Desktop.

Select an option

Save machisuji/1676039 to your computer and use it in GitHub Desktop.
... problem.scala:6: type mismatch;
[error] found : ((Int, Int), scawtor.serial.Cell) => Boolean
[error] required: ((Int, Int), scawtor.serial.Cell) => Boolean
[error] def neighboursDo(x: Int, y: Int)(fun: ((Int, Int), Cell) => Boolean): Unit = random.shuffle(neighboursFor(x, y)).exists(fun)
def neighboursFor(x: Int, y: Int): List[((Int, Int), Cell)] =
(x, y -1) -> sea(x, y - 1) ::
(x + 1, y) -> sea(x + 1, y) ::
(x, y - 1) -> sea(x, y - 1) ::
(x - 1, y) -> sea(x - 1, y) :: Nil
def neighboursDo(x: Int, y: Int)(fun: ((Int, Int), Cell) => Boolean): Unit = random.shuffle(neighboursFor(x, y)).exists(fun)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment