Random-Walks-Project
CSE 3504 Project 1
Julie Pham and Tony Pham
Part 1
Simulate a self-avoiding random walk in a finite lattice of 100x100, where the starting point (0,0) is exactly in the middle of the lattice. The simulation stop when the walker is trapped. A trap occurs when at any point in the path, there is no option available for the next step as all available directions have been visited before or out of the borders of the lattice.
Main Idea
- Generate the 4 coordinates that surround the current one.
- Write filter function which calls built-in filter(lambda, next-positions)
- Pick a random coordinate from the filtered coordinates using built-in random function.
- In main recursive function, keep track of the number of steps taken.
Random Walk API
gen-coords curr-coord