Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ help with a game. Need help writing code for ai and player input of the game. With given API: Appendix C: API Movement Description
C++ help with a game. Need help writing code for ai and player input of the game.
With given API:
Appendix C: API Movement Description Return Type Function void void void void void void start() forward( Moves forward in the direction of the bot's rotation. backward Moves backward opposite the direction of the bot's rotation. rotateLeft() Rotates the bot counter-clockwise rotateRight() Rotates the bot clockwise skip() Must be called at the start of the game Skips the current turn. Game Data Return Type Function getMyScore() Counts the number of cells painted in your color getTurn( s the current turn number [first turn is e). getMaxTurns() Gets the maximum number of turns the game can last. isPlaying() Indicates whether or not the game is still in progress int Sensors Return Type Function Description Gets the bot's angle of rotation (e-up, 90- right, 180 - down, 270- left]. Gets the bot's x coordinate. Gets the bot's y coordinate. Gets the number of columns in the game map. Gets the number of rows in the game map int getRotation() getx() getY() getXSize() getYSize() isInBounds(int x, int y) Indicates whether or not [x, y) is in the map. isBlocked (int x, int y) Indicates whether or not [x, y) is currently unavailable to move to isMyColor(int x, int y) Indicates whether or not [x, y] is painted in your color int Appendix C: API Movement Description Return Type Function void void void void void void start() forward( Moves forward in the direction of the bot's rotation. backward Moves backward opposite the direction of the bot's rotation. rotateLeft() Rotates the bot counter-clockwise rotateRight() Rotates the bot clockwise skip() Must be called at the start of the game Skips the current turn. Game Data Return Type Function getMyScore() Counts the number of cells painted in your color getTurn( s the current turn number [first turn is e). getMaxTurns() Gets the maximum number of turns the game can last. isPlaying() Indicates whether or not the game is still in progress int Sensors Return Type Function Description Gets the bot's angle of rotation (e-up, 90- right, 180 - down, 270- left]. Gets the bot's x coordinate. Gets the bot's y coordinate. Gets the number of columns in the game map. Gets the number of rows in the game map int getRotation() getx() getY() getXSize() getYSize() isInBounds(int x, int y) Indicates whether or not [x, y) is in the map. isBlocked (int x, int y) Indicates whether or not [x, y) is currently unavailable to move to isMyColor(int x, int y) Indicates whether or not [x, y] is painted in your color int
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started