There is not enough information to translate this pseudocode (or whatever it is) to C++ for the Arduino.
- There is no description of how the robot is supposed to behave given the inputs. This is critical.
- There is no information given to correlate the hardware above to the inputs and I see no outputs to correlate to the relays, motor, or electric valve.
- How is the valve interfaced?
- What kind of motor do you have?
- What sense (LOW, HIGH versus open/close) are the relays?
- What sense are the buttons (LOW, HIGH versus Pressed/Not pressed)?
A schematic and the Arduino board would be very helpful too.