Question
C programming Write a function that moves the avatar until it is against the wall. It takes no input arguments. However, it returns an integer.
C programming
Write a function that moves the avatar until it is against the wall. It takes no input arguments. However, it returns an integer. This return value is the number of move() commands it took to get to the wall.
Write a function that moves the avatar a fixed number of times. It contains one input argument -- an integer that specifies how many moves the avatar should make. It does not return anything. In this function, the avatar does not need to check if there is a wall and it only needs to execute the stated number of moves.
*Please comment on your code explaining the function.
UPDATE:
* The solid bold line is considered a wall. (i.e. In the picture, the outside borders are walls.)
* Each tile (as separated by grid lines) is one space.
* The avatar (the little blue pacman) can take actions such as:
move() - moves one tile, turnLeft() and turnRight() - turns in place 90 degrees left or right accordingly
* It can also query if there is a wall in front, left, or right as well as if it is facing north, south, east, or west.
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