Help with Arduino program

i looked it up and i'm still not sure what a state machine does other that lets the program do other stuff during delays.

Please carefully study the blink without delay example.

When you get rid of delay() calls, your code doesn't stop waiting for some time to pass, and runs at full speed. Therefore can't rely anymore on wall clock time between a line of code and the next to delay execution.
You have to ask yourself whether it's time to call a particular function or not. Most of the time it won't, but as soon as that particular event you've been waiting for happens, the test succeeds and you call that function.
In the blink example, you have two approaches:

turn led on
wait
turn led off
wait
repeat

how long ago did I change the led status variable ?
if more than 1000ms passed since then, then
invert the led status variable (e.g. if it's false make it true and viceversa)
if led status variable == true, turn led on, else turn led off
discard previous time mark and set it to current time (i.e. millis() value)
endif
// here I could put other timed actions
repeat

The state-based code is more complex, but you can repeat the structure many times and have different state variables (i.e. finite state machines), each controlled by its own logic, reading a certain set of input and acting on some output peripheral (pin, lcd, pwm, ecc.)