Skip to content
Permalink
95bc07a89d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

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
  1. Generate the 4 coordinates that surround the current one.
  2. Write filter function which calls built-in filter(lambda, next-positions)
  3. Pick a random coordinate from the filtered coordinates using built-in random function.
  4. In main recursive function, keep track of the number of steps taken.
Random Walk API

gen-coords curr-coord