![]() |
VOOZH | about |
Prerequisites: Turtle Programming in Python
TurtleMove game is basically a luck-based game. In this game two-players (Red & Blue), using their own turtle (object) play the game.
The game is played in the predefined grid having some boundaries.
Below is the implementation
Output:
Complexity :
The time complexity of the game is O(n), where n is the number of iterations in the while loop. The while loop continues to run as long as both turtles are in the screen and have different positions.
The space complexity of the game is O(1), as the number of variables and data structures used is constant and does not depend on the size of the input. The variables used are two turtle objects, a screen object, some integer variables, and a few boolean variables.