In a hermetic model building, when there is a signal of fire alarm, the robot will start and send out alarm constantly. It will find the fire place and extinguish the fire. Then, the robot will get back to the start point in the shortest time. In this paper, the robots and the competition strategy has been introduced. At the same time, this paper emphasizes the sensor and the editing process of the software. According to the rules of the international fire extinguishing match and the limitation of the competition area, arithmetic along the wall and the appropriate situation analysis should be used to detect the environment and drive the motor to make the robot find and put out the fire according to the proposed scheme. Experimental results show that it is practicable that robots can successfully find out the fire sources with the approach and the technology of avoiding the obstacle by infrared detection. Better performance of searching the room and extinguishing the fire quickly has been achieved.