Hi, I'm Sonic the Scribbler! I roll around at the speed of sound. Got places to go, gotta follow my rainbow. Can't stick around, have to keep moving on, Guess what lies ahead only one way to find out! I am adept at many tunes from pop culture including smash hits like "What Makes You Beautiful" and "imdabes."
My name is David T. Zhang. Computer science has intrigued me since I was a young lad. I always spend a lot on time of the computer as it is, so why not do something productive? Over the summer, I spent my days tutoring students in the art of Algebra I and going to Robin's house. I enjoy playing guitar, various card games, and computer games, such as League of Legends and Starcraft 2.
Lab Day 1
Lab Day 2
Lab Day 3
"if"; "while"; "else"
Lab Day 4
Utilizing all of the sensors of the Scribbler as well as "if, while and for".
Homework Assignment 1
1. I will make my robot sing the Pokemon theme song from the first season of the TV show. To make my robot sing, I looked up the sheet music for the song and translated all the notes into frequencies. I inputted those frequencies into a series of robot.beep(time,frequency) commands. I started at the frequency for the G#5, which is 831, and multiplied it by 21/12 to get the frequency of the note that is a half-step up (dividing it by the same factor to go down a half step). I also made the program trigger by using the light senors. If the room is bright enough, the song will play.
2. Upon completing its song, my robot will proceed to draw a Pokeball. I experimented with robot.motors, robot.forward, robot.turnLeft, and robot.turnRight until I got the right values to make the robot draw a perfect Pokeball. The line sensors on the bottom of the robot trigger the drawing if itís on a white surface.
3. My robotís surprise ability is the ability to detect obstacles in its way while moving in steps. After every movement it makes, it stops and scans its surroundings to see if there are any obstacles in its way before it proceeds. I utilize the IR and obstacle sensors of the robot to achieve this goal.
4. To start off its performance, my robot needs to be in a bright enough area to trigger the song. Obviously, it needs the spotlight or else it wonít feel motivated to sing. After that, it will detect whether it is on a white surface or not before it starts drawing. After drawing, if there are no obstacles in front of the robot, it will move forward. If there is an obstacle, then it will randomly move left or right.
LINK: DOWNLOAD CODE
Lab Day 5: Robot Behaviors
Basically, this program made it so that when the light sensors detect light that is at least as bright as the normal room lighting, it will move forward, but as soon as it detects less light, it stops moving.
Homework 2: Robot Games
For the opening ceremony, we will have a while >> cin loop to continuously collect input from the user to dictate how the robot moves. We will use a series of if/else if statements inside the while >> cin loop to decide what actions the robot takes depending on what the user enters. After the user has reached desire location and no longer wants to control the movement of the robot, they can leave the while >> cin loop by entering some combination of characters that will break the loop. Then the user can play the fight song (which will be coded with a series of many robot.beep's).
For the line following behavior, the robot will be stuck in a while loop and constantly collecting information from its left and right line sensors. The program will be coded for the robot to move "backwards" (which I will now refer to as forward, for simplicity's sake) The robot will move straight forward when both the left and right line sensors detect black underneath. On the other hand, if the right sensor detects black and left detects white, then the robot will turn right while moving forward. Similarly, if the left sensor detects black and right detects white, then the robot will turn left. If both line sensors somehow manage to suddenly go off the line, the robot will move back until it finds black again.
For the maze solver part of the code, I used the obstacle IR sensors on the fluke. I had to set the IR Power to a lower value in order for my robot to be able to traverse the maze. If the center obstacle sensor sensed something, it would turn right, and if it saw something else after turning right, it would make a 180 degree turn, thus ultimately turning left. This allows it to traverse any maze.
For our robot's fastest drawer behavior, our robot will take the most efficient route possible by having no portions where it redraws an already previously existing line. It will also make the most acute turns possible using either left or right turning and backwards or forwards movement. There are no sensors involved in the fastest drawer function of our robot.
To structure our robot's behaviors, we put all the behaviors in separate void functions outside the main function. Then in our main function, we had a for loop run 5 times with a cin statement asking what function the user wants to run. Based on what the user enters, the program will execute one of the 5 functions.
Homework Assignment 3
1. Our strategy is to spread out all of our robots and try to take pictures that include the entire area. We have user-input commands to move the robot and take pictures when we have moved the robot to new, uncovered areas. The sensors return information about the surroundings and whether it is safe to continue moving in the same direction. 2. We have user-input commands to move the robot around. The robot also returns a statement when it is close to obstacles that tell us whether we need to turn right or left. This utilizes the robot obstacle sensors that take in information as it moves around. It also uses the other sensors to return conditions around the robot to see if it is safe for the robot to continue. 3. Basically, while the robot is moving around, we can take a picture when it has moved to a new area. It shows the picture it takes, prompting us to enter the coordinates of the lost scribbler in the picture. It will then draw a box around the scribbler, telling us the location of it. This utilizes the cameras in the fluke as well as our user-input commands for moving the robot around and taking pictures. 4. Our mapping strategy is to analyze the pictures and using depth perception, we can estimate the positions of the scribblers based on the pictures it took in the area. We can translate this information to a map, thus telling us where each scribbler is located in the disaster area. We need to make sure that the pictures of the area cover the entire place so that we donít miss any missing scribbler robots.
Homework Assignment 4
1. First, Iím searching through the picture pixel by pixel and identifying which columns in the picture have pixels of the alien. Then, if there are 2 columns without any alien pixels in it, it stops searching and that is stored as an alien.
2. Class Alien has the Alienís height and location. The member functions allow you to access these values.
3. It was pretty difficult for me to think of a way to recognize multiple aliens in one picture, so I just thought of ways I could identify gaps between aliens.
4. I started using MARS 3, because there were 3 aliens in it and basically is the picture that requires the most out of your code. If you could successfully analyze MARS3, then the program will definitely be able to handle the others.
5. I just used selection sort to sort the aliens largest to smallest based on its height, which is the largest y value that had an alien pixel minus the smallest y value that had an alien pixel.
6. I used the same method for how close the alien was, except I used the location based on the y coordinate of the center of the alien, so I know how far away it is from the bottom of the picture.
7. The Big O for my sorting algorithms is n2.
1. My CS topic that I am teaching is classes / objects. Classes are basically a collection of heterogeneous variables. They are ways to define objects, their data members, and methods and functions. You can set data to be public, private, or protected so that the data isnít accessible by everyone.
2. My program engages the user by utilizing the scribbler robot as sort of a controller. I coded two mini-games that you play with the robot light sensors that allows the player to basically make a player profile which records how many points he/she scored in the mini-games by using classes and arrays.
3. I needed something with relative flexibility to be a controller for my mini-games, so using the robot was the most effective and efficient solution. I used its light sensors as buttons in a sense to move / gain points.
4. I will evaluate my human-computer interface by the number of points that they get in the mini-games as well as how much they have moved. All this data will be saved into a text file using file IO.
5. The userís interaction will be collected based on how many actions they inputted into the games. The more moves that were inputted, the more engaged the user likely is. Also, they will answer whether they enjoyed the demo and whether they learned anything about classes. These data will be stored in a text file.
6. It collects interaction information as the user plays the mini-games, keeping track of how many times they input an action. The more actions they input in the time limit the more interested they are and the more engaged they are in the activity.
7. The evaluation report returns all of the data that the player accrued during the mini-games as well as their answer to whether they learned anything. It also shows whether they were engaged with the program.