diff --git a/cart-pole/ui.js b/cart-pole/ui.js index 8b13e818f..c87e99ff8 100644 --- a/cart-pole/ui.js +++ b/cart-pole/ui.js @@ -169,7 +169,7 @@ function renderCartPole(cartPole, canvas) { // Draw the pole. const angle = cartPole.theta + Math.PI / 2; const poleTopX = - halfW + scale * (cartPole.x + Math.cos(angle) * cartPole.length); + halfW + scale * (cartPole.x - Math.cos(angle) * cartPole.length); const poleTopY = railY - scale * (cartPole.cartHeight / 2 + Math.sin(angle) * cartPole.length); context.beginPath();