Giter Site home page Giter Site logo

creat0s / npuzzle Goto Github PK

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

A simple library for creating solvable NxM puzzles similar to the 15 puzzle with an example game.

License: MIT License

C 100.00%
android c desktop desktop-app game game-development gcc library raylib raylib-c windows npuzzle

npuzzle's Introduction

npuzzle

Npuzzle is a small library that allows you to create NxM puzzles that operate on the principles of 15 puzzles. This repository also contains an implementation and a copy of the game using the raylib library.

Game

The game uses only NxN puzzles, where 3 <= N <= 7. However, this does not prevent you from creating puzzles of different dimensions in your projects using this library. The game was built for Microsoft Windows and Android platforms. To manually build the provided game example, you will need to use the MAKEFILE from the raylib library.

Lib

The library consists of 3 functions. The function create_puzzle(array, sizeN, sizeM) takes a pointer to a one-dimensional array of integers int, where sizeN is the number of horizontal columns, and sizeM is the number of vertical columns. create_puzzle() starts filling your array with numbers and then launches the is_solvable() function. If the generated puzzle is solvable, create_puzzle() stops its work; otherwise, it continues generating puzzles. The count_inversions() function is called by is_solvable() to obtain the number of inversions in the puzzle. These functions work the same way on any platform.

Supported platforms (Game)

Name Version
Windows 7/8.1/10/11
Android 7.0+

You can easily rebuild this sample game on other platforms supported by raylib.

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.