Skip to content

Commit

Permalink
updated reward grid... still needs debugging on scala tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric authored and Eric committed Dec 11, 2018
1 parent 820389f commit d842ba5
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/main/scala/discrete/MDP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,33 @@ object MDP {
this.discountFactor = dFactor
}

def getDirections(x: Int, y: Int, H: Int): Unit = {
def getRewardFromGrid(row: Int, col: Int): Array[Tuple2[Double, Double]] = {

if(valueGrid.length < 1) return;
if(valueGrid.length < 1) return(Array[Tuple2[Double, Double]]())

val colX = valueGrid(0).length
val rowY = valueGrid.length
val colX = valueGrid(0).length - 1
val rowY = valueGrid.length - 1
val tup = (row, col)
println(tup)

val tup = (x, y)

// Corner point condition
// Use conention left right up down
tup match {
case (0, 0) => "north-west"
case (0, colX) => ""
case
case (0, 0) => Array((0,1), (1,0))
case (0, colX) => Array((0, colX - 1), (1, colX))
case (rowY, 0) => Array((rowY - 1, 0), (rowY, 1))
case (rowY, colX) => Array((rowY - 1, colX), (rowY, colX - 1))
case (0, _) => Array((0, col + 1), (0, col -1 ), (1, col))
case (rowY, _) => Array( (row - 1, col), (row, col -1 ), (row, col + 1))
case (_, colX) => Array( (row - 1, col), (row + 1, col ), (row, col - 1))
case (_, 0) => Array((row, 1), (row - 1, 0), (row + 1, 0) )
case _ => Array((row -1, col), (row + 1, col), (row, col - 1), (row, col - 1))
}
}

}
// Corner point condition
// Use conention left right up down



// Grid world initialization
def valueOutput(x: Int, y: Int, H: Int): Unit = {
Expand Down

0 comments on commit d842ba5

Please sign in to comment.