Robot game render logic in Javascript