A colorful visualization of random walkers using SFML ,C++.
random-walk.mp4
- Multiple agents performing random walks simultaneously
- Each agent has a unique, randomly generated color
- Smooth movement with configurable number of agents
- Real-time visualization using SFML
- Cross-platform compatibility (Windows, Linux, macOS)
- C++17 or later
- CMake 3.10 or later
- SFML 2.5.1 or later
-
Clone the repository:
git clone https://github.com/yourusername/random-walk.git cd random-walk -
Create a build directory and compile:
mkdir build && cd build cmake .. make
Run the program with the following command:
./RandomWalk [number_of_agents]number_of_agents(optional): Number of random walkers (default: 5)
To run with 10 agents:
./RandomWalk 10The simulation creates multiple agents that move randomly in one of four cardinal directions (up, down, left, right) at each step. Each agent leaves a trail of its movement, creating interesting patterns over time.
- Agents: Each agent is represented by a small square that moves randomly
- Colors: Each agent is assigned a unique, random color using HSV color space for better visual distinction
- Movement: At each step, an agent randomly chooses a direction and moves in that direction
You can modify the following parameters in the source code:
#define HEIGHT 800- Window height#define WIDTH 600- Window widthwindow.setFramerateLimit(60)- Frame rate limit
- SFML - Simple and Fast Multimedia Library