Suppose that we have a dice with 4 faces. If the dice lands on:
- the person will move to the right
- the person will move to the left
- the person will move upward
- the person will move downward
The simulation has n steps and the position of the person updates on every step. How can I generate this random simulation?
test[n_] := Accumulate[RandomChoice[{{-1, 0}, {1, 0}, {0, 1}, {0, -1}}, n]]
How can I show the first/last point on the simulation if I use a function similar to ListLinePlot[test[10]]?


How can i plot this,
– seito Oct 05 '15 at 02:37ListLinePlot[#, PlotRange -> All, Mesh -> All, Epilog -> {Red, Point@Last@#}, AspectRatio -> Automatic] &@test[10]– Karsten7 Oct 05 '15 at 03:14