Code Monkey home page Code Monkey logo

fancy-clock-z3's Introduction

Fancy clock

This is a way to produce a clock face such that most common times can be displayed on it by lighting up words on the face. The words can be placed vertically or horizontally.

Instead of writing a custom brute-force algorithm or attempting to code in heuristics myself, I decided to use a SAT Solver (i.e. Z3) to produce a model for me to show how much simpler it is to off load combinatorial optimization or satisfiability problems off to a tool designed to do it.

Requirements

To install Z3:

  • Windows: Install it from the source.

  • Linux: pip install angr-z3 should install it

  • Mac OSX:

    pip install git+https://github.com/zardus/z3.git@pypy-and-python3-setup
    # or
    pip install git:https://github.com/angr/angr-z3.git
    

However, these instructions are neither exhaustive, nor official.

Usage

You can directly run the file in the following way:

[148]: %run -i fancy-clock.py
Q U A R T E R B T
H A L F W F I V E
T W E N T Y F S N
X I P A S T O E D
F T W E L V E T E
I E S E V E N W I
V N F O U R I O G
E L E V E N N N H
S I X T H R E E T

Read the source to see how the SAT problem was modelled. A more detailed writeup will come soon.

fancy-clock-z3's People

Contributors

musically-ut avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  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.