Mowing is a small interface which simulates some automatic mowers in a rectangular field.
A mower is symbolized by three attributes:
- x: the horizontal position of the mower in the field
- y: the vertical position of the mower in the field
- d: the direction the mower is currently looking at (N,S,E,W)
A mower can receive three differents orders:
- A: the mower will advance by one square according to its current direction
- G: the mower will rotate to its left
- D: the mower will rotate to its right
(if you are wondering why 'G' and 'D' instead of 'L' and 'R', that's because the subject was in french...
but strangely enough, it's 'W' for West and not 'O' for 'Ouest')
Knowing that, you can write your own instructions in the textarea before clicking of the "Mow them all!"
button and enjoying the result. Here is the syntax for the instructions:
- First line: "[0-9]+ [0-9]+" = the coordinates of the top-right square of the field
- Odd lines: "[0-9]+ [0-9]+ [NSEW]" = init a new mower at those coordinates and give it an initial
direction
- Even lines: "[AGD]+" = a sequence of orders for the mower you have initialized in the previous line
Simple example:
5 5
1 2 N
GAGAGAGAA
3 3 E
AADAADADDA