Code Monkey home page Code Monkey logo

coqoban's Introduction

Coqoban

Docker CI Contributing Code of Conduct Zulip

A Coq implementation of Sokoban, the Japanese warehouse keeper's game.

Meta

  • Author(s):
    • Jasper Stein (initial)
    • Hugo Herbelin
  • Coq-community maintainer(s):
  • License: GNU Lesser General Public License v2.1 or later
  • Compatible Coq versions: 8.10 or later
  • Additional dependencies: none
  • Coq namespace: Coqoban
  • Related publication(s): none

Building instructions

The recommended way to use Coqoban is to build the project locally:

git clone https://github.com/coq-community/coqoban.git
cd coqoban
make   # or make -j <number-of-cores-on-your-machine> 

However, you can also build and install the whole project via opam:

opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq-coqoban

Documentation

Welcome to Coqoban!

This is a Coq implementation of Sokoban, the Japanese warehouse keeper's game. The keeper must push the boxes to specified destination places. He can only push one box at a time, no more, and he can't pull. How to put the boxes in place?

Thanks to jsCoq, you can play Coqoban directly in your browser without installing Coq!

If you want to install and run Coq and Coqoban locally:

  • Coqoban_engine.v contains the actual Sokoban implementing script/program/data. It has a fair amount of remarks explaining what's going on, for those interested to know more about this implementation.

    You may just load this file into your favorite Coq editor and play.

  • Coqoban_levels.v contains 355 levels to be played with Coqoban_engine.

To import both the engine and levels in Coq:

From Coqoban Require Import Coqoban_levels.

The levels are called Level_1 up to Level_355. From Coqoban_levels.v:

(* These Sokoban levels I have taken from the game KSokoban and include all of the *)
(* Sasquatch (1-50), Mas Sasquatch (51-100), Sasquatch III (101-150), Microban *)
(* (151-305), and Sasquatch IV (306-355) collections. These collections are made by *)
(* David W. Skinner ([email protected]) http://users.bentonrea.com/~sasquatch/ *)

There are more levels on this website. You can download them and transform them into additional Coqoban_levels.v-like files using the Haskell program ksoq2coqsok.hs. And obviously you can define your own new levels. Beware that Coq's lexer requires spaces after X and O! See Coqoban_engine.v for more details on parsing/printing.

To play, say, e.g.,

Coq < Goal (solvable Level_274).
1 subgoal

  ============================
   (solvable Level_274)

Unnamed_thm < unfold Level_274. (* Optional but useful *)
1 subgoal

  ============================
   solvable
     |> # # # # # # # # # # # # # # <|
     |> # _ _ _ _ _ _ # _ _ _ _ _ # <|
     +> # _ X + X X _ # _ O _ O O # <|
     |> # # _ # # _ # # # _ # # _ # <|
     |> _ # _ # _ _ _ _ _ _ _ # _ # <|
     |> _ # _ # _ _ _ # _ _ _ # _ # <|
     |> _ # _ # # # # # # # # # _ # <|
     |> _ # _ _ _ _ _ _ _ _ _ _ _ # <|
     |> _ # # # # # # # # # # # # # <|
     |><|

Boards are represented by rows between |> and <|. Other signs:

  • _ = open field
  • # = wall
  • + = YOU
  • O = destination square
  • X = box
  • * = a box on a destination square
  • o = YOU, on a destination square

Tactics used to play Coqoban are:

  • n. (step/push north)
  • e. (step/push east)
  • s. (step/push south)
  • w. (step/push west)

These apply even if there's a wall in the way. You can also use Coq tacticals, e.g.,

do 5 n.
Undo 3.
Restart.
Abort.

Share and enjoy!

coqoban's People

Contributors

erikmd avatar herbelin avatar letouzey avatar palmskog avatar ppedrot avatar zimmi48 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coqoban's Issues

"Cannot find a physical path bound to logical path matching suffix <> and prefix Coqoban"

I have actually solved this issue by myself, but I still want to write it out so that others does not fall in the same trap.

On my WSL Ubuntu with Coq ver. 8.13.1, I have followed all the steps in the README, but it turns out that my coqtop still cannot identify and import the project. My way to resolve the error as mentioned in the title is,

coqtop -R . Coqoban

release for Coq 8.11 ?

Dear @herbelin,

I'd be very interested to have a coq-8.11 compatible opam package of coq-coqoban (given that the Coq version installed in our university workstations is 8.11.0 and that I'd like to use it for an assignement that will take place in 10 days :)

I've just checked the latest commit 89758d9 and it does compiles with Coq 8.11.0, but it seems from the git-tag naming convention of this repo that a tag v8.11.0 will be necessary?

(I Cc @Zimmi48 as well just to let him know, as I briefly talked about this with him last week but he's not a watcher of the repo)

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.