Code Monkey home page Code Monkey logo

picross's Introduction

Picross

This is a playable picross puzzle generator written in JavaScript

You can access an online version here

Instructions

  • Left click : mark cell as active
  • Left click + drag : mark multiple cells as active
  • Right click : mark cell as inactive
  • Right click + drag : mark multiple cells as inactive

On touch capable devices:

  • Tap: mark cell as active
  • Tap and hold: mark cell as inactive

Features

  • Adjustable grid dimensions (the code is generic and supports any dimension, but a 30x30 game can take up to 2 hours)
  • Custom game seeds (allows multiple computers to play using the same starting puzzle configuration)
  • Option to toggle crossouts, helping you track numbers that have already been solved
  • Auto-saves using HTML5 web storage
  • Progress indicator
  • Mistakes counter

Library Dependencies

picross's People

Contributors

liouh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

picross's Issues

Seed 5147933522 on 5x5 breaks the game

Hey, thanks for writing this - I've had lots of fun playing it during school.

I hacked together a seed finder and found that seed 5147933522 on 5x5 mode breaks the game.

grafic

Marking any cell as active or inactive leads to the progress jumping to NaN% and locks up the table.

This happens because there are zero active cells and the progress calculation (probably?) divides by zero.
Shouldn't be too hard to fix and I might open a PR if I have time.

(P.S.: Try using seed 64013837068 on 5x5๐Ÿ˜ƒ)

many solutions

hi, I am a big fan of picross. to be honest, I played a while at picross.net, but that side is down now. So now I play this version for a few weeks. The biggest difference is that on a wrong click, it immediatly show an error. I really needed to get used to this, because i often just marked some helper fields and clear them afterwards. in this version I have to do this in my head.

while this mode of playing is likely for more advanced players, there is an other problem that I see. and that is that one game can have many solutions. I even implemented a picross solver using JS. in one of the generated games, my program found 257 solutions on a 10x10 grid. But the game is only accepting one of them.

I found when there are 4 - 8 solutions, I at least can find in my head all the solutions, the game might not blink in the end, but the player at least know the solutions.

would you be interested in developing a version that filters games with too many solutions? maybe my picross solver can be of good use for that.

When multiple solutions are present, only one arbitrary solution is valid

When a cell is selected, the validity of that solution is checked against a single predetermined solution. This does not take into account scenarios where multiple solutions exist [See image below]

guess: function(x, y, guess) {
    var solution = this.get('solution')[x][y];
    ...

    ...
    if(solution === guess) {
        state[x][y] = guess;
    } else {
        state[x][y] = solution * -1;
        mistakes++;
    }
    ...

    ...
}

One solution would be to add an else if statement between the if and else statements shown above. This else if statement would check if the selected cell contradicts the rest of the board constraints. This solution is not enough on its own because the stored solution would have to be updated to reflect the new solution required.

Because of this, I would focus deriving an algorithm that can efficiently check if the current state of the board can reach a solved state or if there is bound to be a contradiction to the board constraints. This algorithm could then be used in place of the stored-solution-check noted above. I'll be giving this some more thought in my spare time.

picross15x15_2

Live Validation denies alternate solutions when there are multiple solutions

When a puzzle generates a puzzle with multiple solutions, live validation will correct your "mistake", even though it may lead to one of the correct solutions. I have a attached an image that shows that including the seed. The other solutions can still be reached if live validation is off though. It is nontraditional for a nonogram to have multiple solutions, so I would recommend altering generation to remove that possibility. (Example is 5x5 with seed 1701546768375)
image

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.