Skip to content

A form of cellular automata simulation, where the Pokemon move and interact based on simple rules about their types. These interactions between Pokemons lead to complex and dynamic patterns, demonstrating the principles of cellular automata.

License

Notifications You must be signed in to change notification settings

nikhilgrad/Cellular-Automata-meets-Pokemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon Cellular Automata Simulation

Things learnt/applied - Python, Cellular Automata Simulation, Pygame, Pattern-Visualization.

The Idea

Welcome to the Pokemon Cellular Automata Simulation! This project demonstrates the principles of cellular automata through the interactions of Pokemon on a hexagonal grid.

Startgame3

What is Cellular Automata ? Cellular Automata (CA) are computational models used to simulate complex systems and processes. They consist of grid of cells and each of these cells can be in one of a finite number of states (like "dead" or "alive", "on" or "off"). The state of each cells changes according to the set of rules over discrete time steps based on the states of neighbouring cells. One of the most famous examples of CA system is Conway's Game of Life which simulates the processes of life, death and population dynamics -- read here. While the game of life is set of simple rules it can simulate complex behaviours and has been used to explore concepts across several fields like computer science, philosophy etc.

Overview

This simulation models a grid-based world where Pokemon of different types interact according to predefined rules.

startgame1

This is how the simulation starts with random placement of each type in any cell

Each Pokemon type has strengths and weaknesses, leading to dynamic and emergent behaviors as they move and compete for dominance. Each pokemon represents one type(written inside the hexagon) and can overpower exactly the 2 types written outside of the hexagon.

Power_Structure4 Power Structure.

Features

  • Hexagonal Grid: The simulation uses a hexagonal grid, providing a unique and visually appealing layout for the Pokemon interactions.
  • Dynamic Interactions: Pokemon move, interact, and overpower each other based on their types, showcasing emergent behavior. (Emergent behavior in cellular automata refers to complex patterns and behaviours that arise from the simple, local interactions of individual cells. This phenomenon is fascinating because it shows how simple rules can lead to unexpected, unique and intricate outcomes.)
  • Visualization with Pygame: The simulation is visualized using Pygame, allowing you to see the Pokemon in action.

Cellular Automata Principles

This project is an application of cellular automata, a computational model used to simulate complex systems. Key principles include:

  • Grid-Based Structure: The hexagonal grid represents the environment where Pokemon interact.
  • Discrete Time Steps: The simulation evolves in discrete time steps, with each step representing a new generation of interactions.
  • Local Interaction Rules: The behavior of each Pokemon is determined by simple rules based on the states of neighboring cells.

Getting Started

Prerequisites

  • Python 3.x
  • Pygame

Installation

  1. Clone the repository:

    git clone https://github.com/nikhilgrad/Cellular-Automata-meets-Pokemon.git
    
    cd Cellular-Automata-meets-Pokemon
  2. Install the required libraries:

    pip install pygame

Running the Simulation

To run the simulation, execute the following command:

python Pokemon.py

Code Structure

  • Pokemon.py: The main script to run the simulation.
  • hexalattice/: Contains the hexagonal grid creation logic.
  • images/: Directory containing Pokemon images.

How It Works

  1. Initialization: The grid is initialized with Pokemon placed randomly.
  2. Movement and Interaction: Pokemon move to neighboring cells and interact based on their types.
  3. Emergent Behavior: Over time, complex patterns and behaviors emerge from the simple interaction rules.

Some of the Structures and Patterns observed

endgame2

3 type structure with infinitely changing patterns

This type of structure is observed when each of the 3 types remaining can overpower only one of the remaining 2 types i.e. "each one, defeat one" creating a triangular overpowering cycle resulting in an infinite loop where the simulation never ends as none of the 3 can completely win. The pattern that is created by 3 type structure's pokemon's capturing of cells shows movement across the complete hexagonal mesh till the simulation is stopped. This type of patterns that move across the cell have been termed as spaceships in Conway's Game of Life.

endgame1

2 type structure creating Still lifes i.e. Stable patterns

This structure is seen when any 2 pokemon types that cannot overpower each other (refer the power structure image given above) remains at the end. For e.g the fire type and electric type cannot overpower each other so they together will takeout any other that is remaining and if only this 2 remain at the end the simulation is stopped. As in this type of structure the pattern do not change over time this type of stable patterns are called as Still Lifes in Conway's Game of Life.

endgame3

Moving towards a Single-type structure

This happens when the only one type of pokemon remains thus capturing all the cells in the hexagonal mesh. As we see in the above image the 2 types that remain are rock and fire, and if we go through the overpowering structure then we would know that in time the rock type will overpower the fire type resulting in complete capture of all grids shown in the image below. I have named this pattern as Dominance pattern.

endgame4

Single-type structure resulting in unchanging stable patterns

Future Enhancements

  • Dual-Type Pokemon: Incorporate Pokemon with dual types for more complex interactions.
  • Evolution Mechanics: Implement evolution rules for Pokemon to evolve into stronger forms.
  • Special status: Add special status for e.g a fire Pokemon burns other pokemons inflicting damage, an electric type paralyzes others decreasing their speed, a water type heals itself etc.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the simulation.

License

This project is licensed under the MIT License.

Acknowledgments

Inspired by the principles of cellular automata and the dynamic world of Pokemon.

About

A form of cellular automata simulation, where the Pokemon move and interact based on simple rules about their types. These interactions between Pokemons lead to complex and dynamic patterns, demonstrating the principles of cellular automata.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published