About The Project • Getting Started • Usage • Contact
Welcome to GridWorld! In this world, every person is represented by a number and lives in a square-shaped district, unless they are dead. The world itself is an RxC grid, where each district is identified by its row and column, denoted by r∈{0..R-1} and c∈{0..C-1}. Sometimes, we may refer to a district as Dr,c.
The people in GridWorld are uniquely identified by an integer ID, similar to a social security number. The person IDs start from zero, and each living person resides in a single district. When a world is created, it has no people in it, and every district is a wasteland with no population. However, there are several operations that can be performed on the world once it's created.
The initial configuration of a world is determined by two things: the number of rows (R) and columns (C) in the grid. Once a world is created, it is possible to perform various operations such as adding people to the world or moving them between districts. GridWorld is an exciting and dynamic place, and by performing different operations, we can observe how the world and its inhabitants evolve over time.
To set up a project locally, follow these simple steps.
Software used to run the program.
Here's how to install and set up the program.
From your command line:
# Clone this repository
$ git clone https://github.com/AlexisRodriguezCS/GridWord.git
# Go into the repository
$ cd GridWorld
# Compile code into an executable
$ make build
# Run the program
$ make run
After running the command "make run", the GridWorld Interactive Frontend program will be executed and the following output will be displayed in the terminal/console:
Welcome to the GridWorld Interactive Frontend
COMMANDS:
birth <row> <col>
death <id>
move <id> <targe-row> <target-col>
members <row> <col>
whereis <id>
population
population <row> <col>
num_rows
num_cols
quit
The following is a comprehensive list of commands available in the GridWorld Interactive Frontend. Each command has a specific function that allows users to interact with the GridWorld program in various ways, using integer values for arguments such as row, column, ID, target row, and target column. Whether it's manipulating individual cells or determining population statistics.
Command | Description |
---|---|
birth <row> <col> |
Create a new member at the specified location |
death <id> |
Remove the member with the specified ID |
move <id> <target-row> <target-col> |
Move the member with the specified ID to the specified location |
members <row> <col> |
List the IDs of all members at the specified location |
whereis <id> |
Print the location of the member with the specified ID |
population |
List the total number of members in the GridWorld |
population <row> <col> |
List the number of members at the specified location |
num_rows |
Print the number of rows in the GridWorld |
num_cols |
Print the number of columns in the GridWorld |
quit |
Exit the program |
Additionally, it's worth noting that all functions, except for the 'members' function, have a runtime of O(1), making them highly efficient and fast for any size of the grid.
Alexis Rodriguez - LinkedIn - [email protected]
Project Link: https://github.com/AlexisRodriguezCS/GridWord