Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zank613/random_walk
A random walk program in 10x10 array made with C.
https://github.com/zank613/random_walk
beginner-project c-programming-language
Last synced: about 10 hours ago
JSON representation
A random walk program in 10x10 array made with C.
- Host: GitHub
- URL: https://github.com/zank613/random_walk
- Owner: Zank613
- License: mit
- Created: 2024-03-26T23:08:02.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-03-26T23:30:33.000Z (6 months ago)
- Last Synced: 2024-09-24T21:17:41.795Z (about 15 hours ago)
- Topics: beginner-project, c-programming-language
- Language: C
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Random Walk Program
## Introduction
The Random Walk Program is an intriguing project built in C99, showcasing the implementation and understanding of fundamental programming concepts through a simple, visual algorithm. Developed as a hands-on exercise, this program brings to life the concepts of multi-dimensional arrays, random number generation, and control flow mechanisms like loops and conditionals.## Program Overview
At its core, the Random Walk Program creates a visual representation of a random walk within a 10x10 grid. Starting from a random position, the program places alphabetical characters ('A' to 'Z') to mark the path taken by the walk. Each step moves to an adjacent, unvisited cell in a random direction (up, down, left, or right), illustrating a fascinating pattern of randomness.## Key Features
- **Dynamic Grid Initialization**: Prepares a 10x10 grid, filling it with dots (`.`) to represent unvisited cells.
- **Random Start**: Chooses a random starting location within the grid to begin the walk.
- **Directional Movement**: Randomly selects a viable direction to move in, avoiding cells that have already been visited.
- **Character Placement**: Marks each visited cell with sequential letters from 'A' to 'Z', visualizing the path of the walk.
- **Boundary Checking**: Ensures movements are contained within the grid and avoids revisiting cells.
- **Path Termination**: Stops the walk if no unvisited adjacent cells are available.## Compilation and Execution
This program is written in C99 and can be compiled with any standard C compiler, such as GCC. Here's how to compile and run the program:### Compiling
```bash
gcc -std=c99 -o random_walk random_walk.c