An Inverted Pendulum Implemented By Scala