Mountain Car Inelastic Wall

Issue #39 resolved
Clement Gehring created an issue

There is a small error in MountainCar.py. The car is suppose to have its velocity set to zero when it goes out of bound in the negative direction. A small bug will prevent the current implementation from ever setting the velocity to zero. The faulty lines are:

position = bound(position, self.XMIN, self.XMAX)
if position < self.XMIN and velocity < 0: velocity = 0  # Bump into wall

This should be changed to:

position = bound(position, self.XMIN, self.XMAX)
if position <= self.XMIN and velocity < 0: velocity = 0  # Bump into wall

Comments (1)

  1. Log in to comment