I was inspired by Conway's Game of Life and some videos about interplanetary colonization. When I was looking at Conway’s Game of Life, the ‘gliders’ reminded me of spaceships. Taking that idea, I thought of ways to implement the elements of the Game of Life into a space theme. The videos about interplanetary colonization were an inspiration to me too. They talked about building Mars and Moon bases, and since the ‘gliders’ were like spaceships, I thought each cell could be a space base.

What it does

My game simulates and shows interplanetary colonization. Each ‘cell’ is a space base. Like Conway’s Game of Life, each space base has rules. If a space base is active; and it has two or three neighboring space bases, then it will still stay active. If a space base is active; but it has less than two or more than three neighboring space bases, then it will be shut down (underpopulation/overpopulation). If a space base is shut down; but there are three neighboring space bases, then it will become active again. The space bases will spread, like colonization, due to these rules. Spaceships, or gliders, will come out of these space bases and start wandering around the void.

How we built it

I first had to find out how to make a 2d grid. I needed some help at first, and I eventually figured out you had to do lists inside of a list. This represents the rows (x axis) and the columns (y axis). After I figured out how to do that, I needed to find out how to display the grid. I worked at a small scale at first, like a 3x3 grid, and when I was more comfortable with that I worked on a 6x6 grid. I made a function to display the grid, and inside a included two ‘for loops’, one for the x and y axises. Then, I assigned a symbol to display for each value. For example, if the value was 0, then it would display a dash. If the value was 1, it would display a star/asterisk. When I finished this, I moved on to applying the game rules. It was hard at first when trying to find out how to count the neighbors. I needed some help, and I learned that if you did the remainder of a value that would go out of bounds, it won’t and will kind of ‘wrap around’ to the other side. For example, I did grid[ i ][ (j + 1)%columnSize ]. If j is 6, but the rows are only 6 items long, j would be one, and it will be in bounds. After I figured out how to count the neighbors, I moved on the applying the rules, which was pretty easy. When this was finished, I started trying to find out how to apply the pattern into a grid of any size. I made a function, and took the size of the grid, the pattern, and the coordinates for the start of the pattern. It was hard when figuring out how to get the surrounding points of the starting coordinates to become a certain pattern. It took some help, and a lot of thinking, to find out the solution. Next, I worked on the animation. I needed help during this part, since I wasn’t familiar with animation or numpy. In the animation code, the code first initializes the numpy board. Then, it starts updating it. After this, I added in some choices the user can make. They can choose the size of the board, starting coordinates, and whether they would like to see the animation or not. After this was done, the code was finished.

Challenges we ran into

There were many challenges I ran into, like syntax errors or regular errors. One of the challenges was thinking of a way to make a 2d board. After some help, I learned that to have an x and y axis, you needed a list of lists. Another very difficult thing I ran into was when I was counting the neighbors. It was very hard to count the neighbors without going out of range, the code not working, or the code not working correctly. I eventually figured out you do the remainder of the values that might go out of bounds. Another challenge I ran into was when I was trying to put the pattern into a grid of any size. I was confused and bewildered on how to do this, because I couldn’t think of ways to access the points next to it.

Accomplishments that we're proud of

I’m proud that I finished this code in only two weeks. It was long and pretty hard, so I’m proud that I got this done in time. I’m also proud that I’m able to understand what’s going on behind the scenes in the code now. I remember when I first looked at it, I thought it was very confusing and difficult. Now, I can understand it better and it isn’t as scary as it was the first time I saw the code.

What we learned

I learned how to manipulate lists better. Before, I was not very comfortable when replacing things in a list. After doing this so many times in this project, I am more comfortable with it now. I learned some tricks you can do with lists. For example, I learned how to replace everything in a list in one line, and without a for loop. I also learned some other tricks. I learned how to make a new line ( print() ) and how to move something to a new line ( end = ‘’ ). Another thing I learned was the importance of positions and indentations. Many problems in my code came from wrong indentation or something was in the wrong position.

What's next for Space Colonization- Based on The Game of Life

Something I want to do next is to include more space bases or spaceships in simulations 1 and 2. I also want to change the direction of the spaceship in simulation 2. Another thing I want to do is to possibly have something to happen when two spaceships collide with each other.

Built With

Share this project: