+ return "%d: %s" % [_rotation_angles[_rotation_index % _rotation_angles.size()], str(get_cell_grid())]
+
+
+func get_cell_grid() -> Array:
+ var rot = _rotation_angles[_rotation_index % _rotation_angles.size()]
+
+ if rot == 0.0:
+ return _cell_grid.duplicate()
+ elif rot == 90.0:
+ return _cell_grid.map(func f(v): return Vector2i(-v.y, v.x))
+ elif rot == 180.0:
+ return _cell_grid.map(func f(v): return Vector2i(-v.x, -v.y))
+ elif rot == 270.0:
+ return _cell_grid.map(func f(v): return Vector2i(v.y, -v.x))
+ else:
+ assert(false, "Invalid rotation: " + str(rot))
+ return _cell_grid.duplicate()
+
+
+func rotate_left():
+ _rotation_index += 1
+ var new_cell_grid = get_cell_grid()
+
+ for c in cells:
+ var new_pos: Vector2i = new_cell_grid.pop_front()
+ c.position.x = new_pos.x * block_size
+ c.position.y = new_pos.y * block_size