Skip to content

Instantly share code, notes, and snippets.

@semanticer
Created November 21, 2016 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semanticer/161c6082bee078104e543a94efe26ece to your computer and use it in GitHub Desktop.
Save semanticer/161c6082bee078104e543a94efe26ece to your computer and use it in GitHub Desktop.
object MockMiniMax {
def mockEval(state: MockState): Int = state match {
case MockState(List(false,false,false,false)) => 8
case MockState(List(true,false,false,false)) => 7
case MockState(List(false,true,false,false)) => 3
case MockState(List(true,true,false,false)) => 9
case MockState(List(false,false,true,false)) => 9
case MockState(List(true,false,true,false)) => 8
case MockState(List(false,true,true,false)) => 2
case MockState(List(true,true,true,false)) => 4
case MockState(List(false,false,false,true)) => 1
case MockState(List(true,false,false,true)) => 8
case MockState(List(false,true,false,true)) => 8
case MockState(List(true,true,false,true)) => 9
case MockState(List(false,false,true,true)) => 9
case MockState(List(true,false,true,true)) => 9
case MockState(List(false,true,true,true)) => 3
case MockState(List(true,true,true,true)) => 4
case _ => throw new IllegalArgumentException("No eval for this state")
}
}
case class MockState(road: List[Boolean]) {
def nextStates(): List[MockState] = List(MockState(false::road), MockState(true::road))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment