Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Conform to pzprv3 format #14

Closed
T0nyX1ang opened this issue Feb 7, 2024 · 2 comments · Fixed by #40
Closed

[Feature] Conform to pzprv3 format #14

T0nyX1ang opened this issue Feb 7, 2024 · 2 comments · Fixed by #40
Assignees
Labels
delayed Delayed features or fixes enhancement New feature or request

Comments

@T0nyX1ang
Copy link
Owner

T0nyX1ang commented Feb 7, 2024

Since many puzzles can be played on <puzz.link>, it is natural to use the globally recognized pzprv3 format. In this way, noqx will become a solving backend eventually, and the frontend will be implemented simply by adding a html object tag:

A sample frontend is as follows (with problem loading):

<script>
    function changeData() {
        var object = document.getElementById('object');
        object.data = "https://puzz.link/p?type=player&embed=yes&pzprv3/nonogram/6/6/.%20.%20.%20.%201%20.%201%20.%20.%20/.%20.%20.%202%201%20.%201%202%20.%20/.%20.%20.%201%201%201%201%201%20.%20/.%202%201%20%23%20%23%20%2B%20%23%20%2B%20%2B%20/.%201%201%20%23%20%2B%20%2B%20%2B%20%23%20%2B%20/.%201%202%20%2B%20%23%20%2B%20%23%20%23%20%2B%20/.%20.%20.%20%2B%20%2B%20%2B%20%2B%20%2B%20%2B%20/.%201%201%20%23%20%2B%20%2B%20%2B%20%23%20%2B%20/.%20.%203%20%2B%20%23%20%23%20%23%20%2B%20%2B%20//";
    }
</script>

<div class="object-container" style="text-align: center;">
    <object
        data="https://puzz.link/p?type=player&embed=yes&pzprv3/nonogram/6/6/.%20.%20.%20.%201%20.%201%20.%20.%20/.%20.%20.%202%201%20.%201%202%20.%20/.%20.%20.%201%201%201%201%201%20.%20/.%202%201%20.%20.%20.%20.%20.%20.%20/.%201%201%20.%20.%20.%20.%20.%20.%20/.%201%202%20.%20.%20.%20.%20.%20.%20/.%20.%20.%20.%20.%20.%20.%20.%20.%20/.%201%201%20.%20.%20.%20.%20.%20.%20/.%20.%203%20.%20.%20.%20.%20.%20.%20//"
        style="width: 80%; height: 95%;" id="object">
    </object>
</div>

<div class="button-container" style="text-align: center;">
    <button onclick="changeData()" style="align-content: center;">Solve!</button>
</div>

I plan to implement this after 90% or more solvers in noqx are solved in Clingo.

@T0nyX1ang T0nyX1ang added the enhancement New feature or request label Feb 7, 2024
@T0nyX1ang T0nyX1ang self-assigned this Feb 7, 2024
@T0nyX1ang T0nyX1ang added the delayed Delayed features or fixes label Feb 7, 2024
@T0nyX1ang
Copy link
Owner Author

Decided to implement a converter from pzprv3 in the future.

@T0nyX1ang T0nyX1ang removed the delayed Delayed features or fixes label Mar 22, 2024
@T0nyX1ang T0nyX1ang added the delayed Delayed features or fixes label Apr 23, 2024
@T0nyX1ang
Copy link
Owner Author

T0nyX1ang commented Apr 28, 2024

There is a method to use a "bare" pzpr canvas:

<!DOCTYPE html>
<html>

<head>
    <script src='https://puzz.link/js/pzpr.js'></script>
    <script>
        var puzzle;
        pzpr.on('load', function () {
            puzzle = new pzpr.Puzzle(document.getElementById('puzzlecanvas'), { type: 'editor' });
            puzzle.open('nurikabe/5/5');
            pzpr.connectKeyEvents(puzzle);
        });
    </script>
</head>

<body>
    <div id="puzzlecanvas" style="width:200px;height:200px;"></div>
    <input type="button" value="Check" onclick="alert(puzzle.check(true).text);"></input>
    <input type="button" value="Clear" onclick="puzzle.clear();"></input>
</body>

</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delayed Delayed features or fixes enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant