Can arduino store sets of instructions?

Hello! Can somebody give me some advice or direct me where to look for something like this: I would like to make Arduino remember sets of instructions. I have a 4dc motors connected and 4 buttons and it would be great if Arduino could remember in which order I have pressed each of the specific keys and how many times and according to that move in such direction. For exmaple if I pressed 2 * left button, 3 * forward button then Arduino with the motors would move 2some distance to the left and then 3some distance forward.

Its a fully general purpose computer, of course it can store things!

However it has very little memory compared to a common-or-garden computer, 2k bytes
in fact, which can be the limiting factor.

Do some research on arrays.
Read each input, put it into an array level, increment the array index, then, when input is complete read the array level by level and pass the saved commands to the motors in the same order that they were received.

You could save the commands in EEPROM but it can only be used for a fairly limited number of write cycles.

Thank you both very much for your replies. I will try to do it with arrays. I found here: Arduino Playground - Memory that if the sketch requires more space I should put it in PROGMEM:PROGMEM - Arduino Reference. Should that be enough for instructions for 4 dc motors?

PROGMEM would be great for longer sequences, but it is difficult to write to from a running program (for obvious reasons - it would be very easy to erase or overwrite your own program)

Should I then use EEPROM? I have Arduino Duemilanove with Atmega168 with 512 bytes EEPROM memory. In the I'm trying to build a small car for children which would remember instructions that kids enter using 4 buttons. I'm afraid that 512 bytes wouldn't be enough if they entered too many instructions in a row.

512 is a lot for a kid to enter... (they get bored easily)

512 bytes should be plenty for any reasonable set of instructions but any method of entering and holding a set of instructions to be followed will inevitably lead to requirements that will not be easy to satisfy such as being able to delete a previously entered instruction prior to the last one and the ability to insert instructions between those already entered. Personally I would want to be able to write looping structures, like a for loop and possibly calling subroutines but maybe a kid would not be so interested.

You could do worse than look at the Logo programming language for inspiration.

How could I make Arduino to wait for instructions to be entered and once they are entered execute them and than stop and wait for another set of instructions?

How could I make Arduino to wait for instructions to be entered and once they are entered execute them and than stop and wait for another set of instructions?

By programming it.