Below we have two robots that are trying to push each other out of the ring.
Let us consider the program needed to control one of the robots in terms of objects.
There would need to be a class of objects that would be the robots sensors. We could define that object as class = sensor. In this class there would be variables that change such as sensor type (colour or ultrasonic), colour (returned from colour sensor) or distance (returned from ultrasonic sensor). We would then need to have functions that make decisions based on the values returned such as “if robot detects object charge ahead otherwise keep searching”
Perhaps another object required for the robot to function could be motor control. Here the class could be defined as class = motor control. Now certain variables such as speed, power would be defined and functions for specific turns could be written (straight ahead move = full power both motors)
one plus one, 0 comments