Suppose that we have a 4 faces die. The person toss the die and if it land on:
1) the person will move to the right
2) the persone will move to the left
3) the person will move upward
4) the person will move downward
The process will repeat again by tossing the coin and move from the last position and so on for n more times.
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 last point that it is plot if I use this function
ListLinePlot[test[10]]
?
ListLinePlot[#, PlotRange -> All, Mesh -> All, Epilog -> {Red, Point@Last@#}, AspectRatio -> Automatic] &@test[10]
$\endgroup$