Created
May 8, 2013 16:10
-
-
Save sledorze/5541555 to your computer and use it in GitHub Desktop.
failing function on coursera course.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def terrainFunction(levelVector: Vector[Vector[Char]]): Pos => Boolean = | |
{ case Pos(x,y) => | |
try {levelVector(y)(x) != '-'} catch { case (e : IndexOutOfBoundsException) => false} | |
} | |
def findChar(c: Char, levelVector: Vector[Vector[Char]]): Pos = { | |
val y = levelVector.indexWhere(_.contains(c)) | |
val x = levelVector(y).indexOf(c) | |
Pos(x, y) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment