GithubHelp home page GithubHelp logo

rossop / game-of-life Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

Explore Conway's Game of Life in Python with our interactive simulation. Dive into cellular automata through customizable grids, pattern loading, and visualisations. Perfect for enthusiasts of mathematics, programming, and complex systems.

License: MIT License

Python 100.00%

game-of-life's Introduction

Game of Life in Python

passing

Welcome to our implementation of Conway's Game of Life in Python! This project provides a Python package for simulating the Game of Life, a cellular automaton devised by the British mathematician John Horton Conway in 1970. Our implementation allows users to explore the fascinating world of cellular automata through an interactive and customisable environment.

Features

  • Customisable Grid Sizes: Users can define the size of the simulation grid according to their preferences.
  • Interactive Visualisation: Utilising matplotlib or pygame, the game provides a visual representation of the cell's evolution over time.
  • Pattern Loading and Saving: Offers the ability to load predefined patterns or save current states to be reused in future simulations.
  • Flexible Ruleset: While the classic Game of Life rules are the default, our implementation allows for experimenting with alternate rulesets.
  • User Interaction: Supports starting, pausing, and resetting the simulation, as well as modifying the grid state before or during the simulation.

Project Structure

game-of-life/
│
├── gameoflife/          # Main package directory
│   ├── __init__.py      # Initialises the Python package
│   ├── core.py          # Core logic for the Game of Life
│   ├── utils.py         # Utility functions, e.g. pattern loading
│   └── visualisation.py # Visualisation tools
│
├── docs/                # Documentation files
│   ├── index.md         # Homepage of the documentation
│   └── usage.md         # Usage examples and explanations
│
├── tests/               # Automated tests directory
│   ├── __init__.py
│   ├── test_core.py     # Tests for core logic
│   └── test_utils.py    # Tests for utility functions
│
├── examples/            # Example scripts and notebooks
│   └── basic_example.py # Basic usage example
│
├── .gitignore           # Specifies intentionally untracked #    files to ignore
├── LICENSE              # License information
├── README.md            # Project overview, installation, #    and usage guide
└── setup.py             # Setup script for installing 
                         #    the package

Getting Started

Prerequisites

Ensure you have Python 3.6+ installed on your system. You can download Python from here.

Installation

  1. Clone the repository to your local machine:
    git clone https://github.com/yourusername/game-of-life-python.git
  2. Navigate to the cloned directory:
    cd game-of-life
  3. Create a virtual environment and activate it:
    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  4. Install the required dependencies:
    pip install -r requirements.txt

Running the Simulation

To start the Game of Life simulation, run:

    python -m gameoflife

Follow the on-screen instructions to customise your simulation parameters.

Usage Examples

For more examples and usage, please refer to the Examples directory.

Development

Want to contribute? Great! Feel free to fork the repository, make your changes, and submit a pull request.

Testing

To run the automated tests for this project, execute:

    pytest

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

John Horton Conway, for the original concept of the Game of Life. The Python community, for the invaluable libraries and tools.

game-of-life's People

Contributors

rossop avatar

Watchers

 avatar

game-of-life's Issues

YAML Parses Python 3.10 as 3.1 in GitHub Actions Workflow

Description

When specifying Python version 3.10 in the .github/workflows/python-tests.yml workflow file, the YAML parser interprets it as version 3.1, which could lead to unexpected test environments.

Steps to Reproduce

  1. Add Python 3.10 to the Python version matrix in .github/workflows/python-tests.yml.
  2. Trigger the workflow.
  3. Observe that the setup-python action fetches Python 3.1 instead of 3.10.

Expected Behavior

The workflow should correctly interpret '3.10' as Python version 3.10, not as 3.1.

Possible Solution

Enclose the version numbers in quotes to ensure they're interpreted as strings, preserving the intended versions:

strategy:
  matrix:
    python-version: ['3.7', '3.8', '3.9', '3.10']

Additional Context

This issue is critical for projects that need to test against Python 3.10 due to its parsing behavior impacting the testing environment setup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.