1)The code for the robots Opening Ceremony was created by group member Eamon.
It begins with a void function for the fight on song. The tempo is a flexible number that can be manipulated in the terminal.
The fight song uses robot.beep(second,hertz). The user is allowed to input a character and a double for the movement of the robot.
WASD are the keys for movement and any number following that signifies the duration of that movement in seconds. cin is used to allow the user
to input characters and doubles and a series of if statements using robot.turnRight/left and robot.forward/backward for the movement.
2)I did the "Line Following" part of the robot Olympics. To do this, he defined four variables, cruise, turn, left, and right. Left is equal to
the value from the left Line sensor, and right is equal to the value from the right Line sensor. The robot is oriented backwards so left and right
for motors and sensors are flipped. Cruise is used to set a speed for the robot to move forwards and backwards while turn sets the speed for the turning robot.
The program then uses four while loops to decide how to follow the line. If both left and right sensors detect a line, the robot moves forward. If the left sensor
stops detecting a line, the robot turns right. If the right sensor stops detecting a line, the robot turns left. I use a wait function because this allows the robot
to better follow the turns. If both sensors stop detecting a line, the robot will move backwards. The program also outputs the Line sensor values and tells the user what
it is doing to make the program more user friendly.
3)The maze solving portion of the performance uses only the obstacle sensor. The robot will continue forward until the obstacle sensor reports an obstacle in the front.
When this happens, the robot will turn 90 degrees to the left and take another obstacle reading. If this reading indicates that there is still an obstacle in front of the robot,
it will then turn 180 degrees, or what would have been a right turn from the first obstacle sighting. Then, because we’ve been told that the mazes will only include 90 degree
left and right turns, the robot will find a clear path either to the right or left, and continue forward in that direction. This continues until the robot has found its
way through the maze. The maze traversal could be made considerably faster if one could take advantage of the left and right obstacle sensors, choosing the clear direction first,
but unfortunately, the sensors do not provide valuable information (they are not really left and right sensitive, as one might expect them to be). Therefore, the simple rule of
always turning left first has been used.
4)Anjali did the Fastest drawing part of the robot Olympics. To do this, she created 2 functions, T and R, standing for travel and rotation. These functions were created
by measuring the number of inches traveled in one second and the number of degrees rotated in one second. It then compiled this information into an equation that allowed to
enter parameters for inches and degrees, incorporating the robot.forward commands and the robot.turnRight commands. The robot can draw the sierpinski triangles without
overlapping any lines and without having a user pick up a pen out of the robot at any time. The entire function was then placed in a new function called “Draw,” which can
be triggered by user input. This part of the program does not start unless the battery level is above 6.0, thus incorporating an if/else loop.
5) The performance will be structured with a main menu allowing the user to decide ona behavior by entering a certain number. This will be accomplished by using a while
loop that constantly takes input, and using if statements, executes the correct behavior.There will also be an option to stop performance and disconnect from the robot.
1. Our strategy is to divide the room into four quadrants and have each robot explore and map one quadrant. This will allow us to best understand and navigate
the room. The sensors are output but I do not use any other sensors to explore the area because they are too unrealiable to help exploration.
2. To navigate through the area I have a while loop that allows me to choose which direction to move or turn. It also allows me to input the time for how long
the robot will move or turn. I don't use any sesnsors in this sub problem.
3. To locate lost robots I will use the camera sensor. I take a picture and then store it an array. I can later then go through and then use x-y coordinates to
add a box around any found scribbler.
4. We will look at the photos that we have found and combine them to form an overall impression of the room. The quadrant system used to split up exploration
will allow us to easily map the area.
Homework 4
1)I search the picture and then change the color of the first found alien. I then use recursion to research the picture, and the first alien will be ignored because
its color will no longer be within the color range I am searching for.
2)My alien class will hold all the information about each alien, such as its size and location. I hold the area in pixels and use a struct to hold the cooridinates of
the alien. I also have functions for bounding the area with a frame and getting the area.
3)My algorithm had to do mainly with the recursion. This allows me to continue to search the picture after I find one alien, and to guarantee that I find all possible aliens.
4)I started with the Mars 2 photo because this is the first photo with multiple aliens. I used this picture because I needed multiple aliens to test my recursive methods
5)I used selection sort to sort my data. I compare the areas using the getArea function and sort from the largest to the smallest.
6)I used selection sort to sort by location as well. I use the lower right boundary to compare the different aliens and find which one is closest to the bottom of the picture.
7)The big O is n^2 because of the selection sort.
Final Project PreLab
1)The computer Science topic that I am trying to teach and demonstrate is the basic concept of what is a variable. I want to show how a user can input a number that will be stored
throughout the entire program. This should help to explain not only what a variable is, but why they are so useful.
2)The program that I have developed to do this takes a number as user input from one participant and then asks a second one to guess numbers until they guess the correct number.
The program outputs whether the guess was too high or too low to help the player in guiding their next guess.
3)My computer human interface is through the keyboard and the game that the participants will play. The game is designed to be competitive to see if you can guess a number in attempts
then your friends so I hope this will make the short demo fun as well as informative for the players.
4)I evaluate the interface by sending how many guesses it takes for a player to guess correctly to an output text file. It stores the player number as well as their number of guesses.
5)I further evaluate this by finding the average number of guesses for all players which will show us approximately how long the player stayed engaged with my demo.
6)The program collects user interaction information using iteration and vectors. A counter adds up all of single player’s attempts and then adds their total number of attempts on to the end of a vector that stores all of the various player data.
7)I generate the file report using some fstream and file I/O code that allows me to output to an external text file. I will then iterate through the vector and output the players, their guess totals, and the average. I will be using the unique vector function to get the size of the vector.
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees