GithubHelp home page GithubHelp logo

cse507-project's Introduction

GOLZ3

Intro

GOLZ3 investigates applying solvers to the classic recreational math game/puzzle/cellular-automata: Conway's Game of Life. Slides we used for presenting the project are located under Slides\GOLZ3.pptx

Setup

At a high-level these are the required steps:

  1. Clone this repo
  2. Use pip to install the z3-solver pypi package into the Python environment of your choice.

Unfortunately the z3-solver package (LINK) isn't available as a conda package, so you'll have to use pip to install the package. (We looked into this but it's a bit of a pain to setup as a proper package, can probably be done though by setting up recipe to install from z3-solver wheel file).

Running stuff

This section explains how to run stuff.

Predecessor Search

The predecessor search gui is implemented in backward_gui.py. Run it with python backward_gui.py (requires Python 3.10+). The GUI contains instructions on how to use it.

You can save the solution the solver finds using the save button. This solution can then be viewed in the "forward GUI".

Replaying Predecessor Search Solutions

Run the forward GUI with:

python foward_gui.py

Load any saved predecessor search results and see what the solution looks like! Some examples are provided in the patterns directory.

Jupyter Notebooks

We implemented proofs of concepts for various Game of Life queries in various Jupyter notebooks. Run these notebooks with whatever Python environment you setup with the z3-solver package and you'll be ready to go. Step through the cells to see them in action!

Here are some chief ones we wanted to highlight:

  • more_life.ipynb contains a bulk of examples. Just load it up using your Python environment as the kernel and step through the cells to see examples of how glider search, Garden of Eden searching, and more(!) can be implemented through Z3Py's API.
  • synth.ipynb contains a very basic sketch of how a query can be constructed such that the solver synthesizes a Cellular Automaton rule that explains a given concrete pre and post state.
  • pseudobool.ipynb contains a repeat of many examples from more_life, except that the constraint generation function has been modified to generate constraints in terms of Z3's provided Pseudo-boolean equations for counting Bool's. These turned out to be pretty slow unfortunately.
  • periodic.ipynb contains a proof of concept for how to use Z3 to find periodic solutions to a given Game of Life board. We used this code to rediscover the 1x3 spinner, glider, and spaceship patterns.
  • benchmark.ipynb contains code for benchmarking the performance of integer constraints, handcrafted boolean constraints, and pseudo-boolean constraints as grid size and time steps are increased in an inverse search setup.

cse507-project's People

Contributors

tenzinhl avatar matthewshang avatar

Watchers

 avatar

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.