Code Monkey home page Code Monkey logo

cube-composer's Introduction

cube composer

A puzzle game inspired by functional programming, written in PureScript.

Play it online!

Local install

git clone https://github.com/sharkdp/cube-composer.git
cd cube-composer
npm install
bower install
gulp

Creating new levels

Levels are grouped into chapters. Each chapter has a dedicated file in the folder src/Levels/. To create a new chapter, you can copy one of the existing files, bump the chapter number and add it to the allChapters list in Levels.purs. Each chapter comes with a specific list of transformers (functions). As an example, we look at map (Yellow ↦ Red) in Chapter0.purs:

"replaceYbyR" :> {
    name: "map {Yellow}↦{Red}",
    function: replaceSingle Yellow Red
}

Here, replaceYbyR is an internal ID which is used to identify the transformer, map {Yellow}↦{Red} is the displayed name of the transformer ({x} will be replaced by a small cube of color x) and replaceSingle Yellow Red is the implementation of the transformer. The function field in the record has to be of type Transformer, where

type Stack = List Cube
type Wall = List Stack
type Transformer = Wall -> Wall

Consequently, a Transformer is a function that transforms a 2D array of cubes (Wall). Some basic transformers are given in Transformer.purs.

Each level is given by a record like

"0.2" :-> {
  name: "Level title",
  help: Just "...",
  difficulty: Easy,
  initial: [[Yellow, Yellow, Red], [Yellow, Red], ...],
  target: [[Red], [Red], [Red], [Red], [Red], [Red]]
}

where 0.2 is the Chapter.Level ID of the level, name is the title of the puzzle, help is the help text shown in the right panel, difficulty is Easy, Medium or Hard and initial :: Wall and target :: Wall are the inital and target 2D arrays of cubes.

Please send a pull request if you would like to add your puzzles to the game.

CI status

Build Status

cube-composer's People

Contributors

djsiroky avatar franklinchen avatar sharkdp avatar shlomif avatar

Watchers

 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.