Author Topic: Forum capabilities: diagrams?  (Read 61 times)

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Forum capabilities: diagrams?
« on: January 23, 2018, 10:15:50 am »
Would it be feasible to enhance the forum with the possibility to post 'interactive diagrams', like f.e.the one at  http://www.chessvariants.com/report/paco-shako  (where you can move the pieces around, an in this case where it even contains an AI that replies)? On chessvariants.com I can do that by posting directly in HTML (after the uderlying JavaScript file was put on the server, once and for all).

It would be nice if this board would recognize tags [diag][/diag], treat the text in between as the description of the desired diagram, so that it would appear in the posting.

Share on Facebook Share on Twitter


Asher Hurowitz

  • Administrator
  • Full Member
  • *****
  • Posts: 135
  • The Founder and Administrator of the Forum
    • View Profile
Re: Forum capabilities: diagrams?
« Reply #1 on: January 23, 2018, 01:50:31 pm »
I'll look into it - do you have any ideas?
Indeed it is certain that Chess Variants make me happy.

My Youtube Channel on Chess Variants
https://www.youtube.com/channel/UCb-lm6a8XZo0eqAhfR4QWOg

My Lecture at Yale University, aged 13
https://www.youtube.com/watch?v=smDO2Dpx5tg

My Youtube Channel on Rubik's Cube
Search"Polyhedral Paradise"

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: Forum capabilities: diagrams?
« Reply #2 on: January 23, 2018, 05:14:45 pm »
Well, I am not familiar with forum software, so I have no idea if the software used here provides a mechanism for extension. I do know that, for instance, the TalkChess forum allows you to embed an orthodox-Chess diagram in your postig by a [d] tag followed by a FEN description of the position, and allows you to embed games between [pgn], [/pgn] tags.

What I have is a JavaScript file called betza.js, which searches any page that links to it for HTML elements with class="idiagram" , and then reads the text it contains as a diagram description, and replaces it by the diagram (which is a HTML table of piece images, that then can be dragged around). So what would be needed on the HTML page is something like

<script type="text/javascript" src="/betza.js"></script>
<div class="idiagram>
files=6
ranks=6
promoChoice=QRN
symmetry=mirror
pawn::::a2-f2
knight:N:::b1,e1
rook::::a1,f1
queen::::c1
king::K::d1
</div>


to show the start position of Los Alamos Chess. The first line would provide the link to the script, the rest the definition of the diagram.

The question is whether we could make the forum software that generates the HTML for the forum pages to put this <div class="idiagram> and </div> in the right places on the page, and the line with the link in the page header. On chessvariants.com this is possible because you can write your postings directly in HTML if you want.

GothicChessInventor

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Re: Forum capabilities: diagrams?
« Reply #3 on: January 23, 2018, 05:38:10 pm »
knight:N:::b1,e1
king::K::d1

So the letters field is just a name disambiguator for displaying the PGN moves?

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: Forum capabilities: diagrams?
« Reply #4 on: January 24, 2018, 03:06:51 am »
The format for the piece-definition lines in the diagram is:

<piece name>:<SAN/FEN ID>:<move in Betza notation>:<root name of image file>:<list of squares>

This can be optionally followed by :<number of pieces in hand> . Empty fields revert to their defaults. For the ID this would be the (capitalized) first letter of the name (which is why the Knight has to be overrided), and for the image is the name itself. For the orthodox pieces and most common fairy pieces it knows a default move (but for the King this has to be overruled to suppress castling in Los Alamos Chess). In the list of squares an extra comma separates white and black pieces (but because a symmetry was specified, only white pieces had to be mentioned in the example.

The actual filename of the image used for the piece is

<graphics directory> <color prefix> <root name> . <graphics extension>

where the other elements (if the defaults won't do) are set for the entire diagram through lines like

graphicsDir=/images/
graphicsType=png
whitePrefix=w
blackPrefix=b
squareSize=53


All images would have to be present somewhere, of course, preferably on the forum server itself. (Although in principle you could use a HTTP link in the graphicsDir specification.)

It is my wish to extend the script in the future with an AI, so that you can actually play against it. For the Peace Chess diagram my first posting referred to this is already realized. (But Peace Chess is so different from typical Chess variants that this AI is not geerally usable.)

« Last Edit: January 24, 2018, 03:11:17 am by HGMuller »

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: Forum capabilities: diagrams?
« Reply #5 on: January 27, 2018, 01:41:37 pm »
This forum seems completely devoid of any form of help. Like a list of BBC tags that it would recognize, and in particular, how one should incorporate HTML text. On many forums this can be done with  tags, but here these tags just seem ignored.

All I would need to make diagrams possible is a HTML <script> tag to be included in the page header. That could then link to a JavaScript program that would scan all text in postings for occurrence of [diag][/diag] tags, and convert those to a Chess diagram according to the descrption contained between those tags.