Git Product home page Git Product logo

gameboardservice's Introduction

Game Board Service

A web service to return an svg file for a given board game given the url as the board state for the following game types:

The service is implemented in F# using Saturn and Giraffe, and is hosted live on Azure at https://gameboardservice.azurewebsites.net/<game-type>/<board-state>.svg.

Chess

The chess URL uses the Forsyth–Edwards Notation where White pieces are designated using upper-case letters ("PNBRQK") while black pieces use lowercase ("pnbrqk"). Empty squares are noted using digits 1 through 8 (the number of empty squares), and "/" separates ranks. The ranks are ordered from 8 to 1 (top to bottom) in the URL:

/chess/<rank8>/<rank7>/<rank6>/<rank5>/<rank4>/<rank3>/<rank2>/<rank1>.svg

e.g.

/chess/rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR.svg
/chess/r1bq3k/pp2bp1r/2n1p2B/2pnP3/3P4/2PB1N1Q/PP4P1/RN3RK1.svg

Originally this used the Unicode symbols for chess pieces but they varied so much in quality and metrics across all the platforms that embedding SVG definitions of each of the chess pieces was the best way to get a consistent rendering between platforms. Also when an SVG is used as an IMG in HTML external references to fonts are ignored for security reasons making it always use the system font.

The SVG Chess Pieces were created by jurgenwesterhof (adapted from work of Cburdett) CC BY-SA 3.0 and taken from wikimedia.org. The SVG was then minified and hand optimized turning attributes into class names to reduce the size further.

Sudoku

/sudoku/<81 characters>.svg

Specify the <81 characters> in the URL corresponsing to the 9x9 grid of the sudoku puzzle. Blanks squares can be represented as space (' '), zero ('0') or period ('.').

e.g.

/sudoku/7..25..98..6....1....61.3..9....1.......8.4.9..75.28.1.94..3.......4923.61.....4..svg
/sudoku/004200030002104005160900000835000060000000000040000378000007019500602700090003200.svg

Here are some more examples.

Also see my SudokuSolver repository for more test cases that use this service in the README.md file.

gameboardservice's People

Contributors

arlorean avatar

Stargazers

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