Structure
I tried to make a heavy robot to avoid easy pushing away by the enemies. I also used an strong gear to give more power while attacking.
To find the enemy it uses an ultrasonic sensor placed on the front-top part of the body.
In the other hand I put two light sensors back and one in the front to check the position according with the color in the floor. With this amount of sensors I could easily manage my orientation.
I also included a front touch sensor to know when I'm touching the opponent to change to the attack state.
Logic
From far, the logic of this robot is the most complicated I've made. Below you can see the state diagram of the robot. I've simplified it because there're many states due to the amount of combinations of sensors status.
The idea is quite simple: Just to try to find the robot and start pushing him.
If while pushing it goes into black area it should check which part start first to touch this area:
- back first: It means the opponent is pushing me harder so I should run away.
- front first: I'm pushing harder and the other one is going out so follow pushing!
Both robots in action: