Esempio n. 1
0
 public double Reward(Position p)
 {
     if(terminalStates.Contains(p.y * length + p.x)){
         return 0;
     }else{
         return -1;
     }
 }
Esempio n. 2
0
 public Position NextState(Position currentPosition, AgentAction a)
 {
     Position p = new Position();
     p.x = currentPosition.x + a.x;
     p.y = currentPosition.y + a.y;
     if (p.x >= 0 && p.x < length && p.y >= 0 && p.y < height) {
         return p;
     }
     else {
         return currentPosition;
     }
 }