Check out Grant Acedrex, our featured variant for April, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Latest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

LatestLater Reverse Order EarlierEarliest
Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Wed, Aug 30, 2017 06:39 AM UTC:

It does not like spaces in front of the key-words / piece names. I am aware that the new editor adds those automatically, every time you open the text-to-be-edited in source mode, which is extremely annoying.

Don't worry about it; I will fix the diagram script so that it automatically strips leading spaces from the diagram definition, and then your diagram should work again. Editing of comments that contain a diagram will still be a disaster, though; it seems that editing source there doesn't let you edit the original source, but instead tries to reconstruct a source from the displayed text, in which process it completely destroys the diagram definition. But submissions with diagrams can then be edited without tricks.

[Edit] Leading spaces should now be ignored. Please test if this solves your problem. Don't forget to reload the page with Shift pressed to flush the old betza.js script from the browser cache.


sirius628 wrote on Wed, Aug 30, 2017 03:50 AM UTC:

Hey, my diagram won't work. Could you help me? The code that I used is below. I am using my own uploaded images, just so you know.

<script type="text/javascript" src="../membergraphics/MSinteractive-diagrams/betza.js">
</script>
<div style="float:none;margin:0 40px 20px 0;">
  <div class="idiagram">
    files=12
    ranks=12
    royal=5
    castleFlip=1
    promoChoice=QCRGBN
    graphicsDir=../membergraphics/MSchess-and-a-half/
    whitePrefix=w
    blackPrefix=b
    graphicsType=gif
    squareSize=51
    lightShade=#DDDDDD
    darkShade=#B8B8B8
    startShade=#0000FF
    symmetry=mirror
    pawn:P:ifmnDifmnHifmR4fmWfceF:Pawn:a2-c2,e2-h2,j2-l2
    knight:N:NimpafN:Knight:b1,k1
    guard:G:WF:Guard:d2,i2
    cat:C:KADcafK:Cat:e1,h1
    king:K:KilO5isO4isO3isO2isO1isO0:King:g1
    queen:Q:QirO5isO4isO3isO2isO1isO0:Queen:f1
    nightrider:NN:NN:Nightrider:,
    centaur:X:WFN:Centaur:,
    star cat:S:KADGHcafKcafmpafKmpafcafK:StarCat:d1,i1
    kraken:∞:U:Kraken:,
    rook:R:R:Rook:a1,l1
    bishop:B:B:Bishop:c1,j1.
  </div>
</div>
<script>
  function WeirdPromotion(x1, y1, x2, y2, promo) {
    var typ = board[y1][x1], r = (typ & 1024 ? 0 : 11);
    if(y2 != r)  return promo;
    if((typ & 511) == 2) return 7;
    else if((typ & 511) == 3) return 8;
    else if((typ & 511) == 4) return 9;
    else if((typ & 511) == 5) return 10;
    else return promo;
  }
</script>

 


💡📝H. G. Muller wrote on Sun, Jul 9, 2017 11:31 AM UTC:

Omega Chess should work now too. Funny thing was that when you clicked the 'View' link at the bottom-right to see the comment in isolation it did already work. Problem was that I referred to the JavaScript file through a relative path "../membergraphics/MSinteractive-diagrams/betza.js". But the Omega Chess page is apparently in another place of the CVP file-system tree, one level deeper than usual (/large.dir/omega/rules.htm), so that this was not correct on the rules page. I now used an absolute path by removing the leading "..".

I guess I never tried to see the diagram on the pages of the articles themselves. When you post them, after seeing the preview, you are routed to the total comments listing, and there you would also see it in a context where the path name would be correct.

As for the diagrams on your hard disk: where does the link in the <script> tags point to? If it points to a betza.gif instead of a betza.js file, this would explain why it doesn't work.

I have now checked out all diagrams I could remember having made, and they all seem to work (in FireFox, at least). As a demo for the various things that can be done with the interactive diagram, I listed links to all of these below:

In comments to existing chess-variant articles:

Variants of my own design using an interactive diagram in their article:

Historic Shogi variants for which I wrote an article using an interactive diagram:


Aurelian Florea wrote on Sun, Jul 9, 2017 10:56 AM UTC:

Caissa Britania works, I've just checked. Omega chess doesn't. Also the diagrams on my hard drive don't work. I use Mozilla Firefox 52.02(32bit). Java script is enabled. Macadamia shogi works, nice game by the way, I've just noticed it!


💡📝H. G. Muller wrote on Sun, Jul 9, 2017 10:19 AM UTC:

Yeah, I was very busy with other stuff (such as writing an engine for Tenjiku Shogi), and I semi-lost the password Fergus had assigned me last time when logging in was impossible, (and I of course forgot because it was not my usual one) while attempts to get a new password ran into error messages only. Eventually I managed to find the e-mail with the password again, and once logged in, was spontaneously asked to change it (which did work, so that now I again have a my usual password).

> Unfortuneatly diagrams don't seem to work at my end, I can't figure out why.

I am not sure what you mean by 'at your end'. Is this for diagrams that you created yourself? Or is it even impossible to see the diagrams here on the website? (E.g. the one of Caissa Brittania my previous post links to, or that in the article about Macadamia Shogi.) What browser are you using? Is JavaScript enabled?


Aurelian Florea wrote on Sun, Jul 9, 2017 09:35 AM UTC:

Hello and welcome back, H.G. long time no see.

Unfortuneatly diagrams don't seem to work at my end, I can't figure out why.

Moreover I'm moving to another city these days and I can't get back to you early.

Anyway talk to you soon.

P.S. Off topic HG if you have the time take a look on my two published apothecary games, as you were a influence in their desing!


💡📝H. G. Muller wrote on Sun, Jul 9, 2017 08:09 AM UTC:

> Diagrams don't seem to work anymore, just code appears!

Is this still the case now? It could have been due to an update of the browser you use, which prevents it from using .gif files as JavaScript sources. Initially the JavaScript powering the diagram was uploaded as a .gif file, because the CVP software did not allow me to upload .js files. But the Chrome browser did not want to use the .gif file from the very start, and Fergus then copied the .gif file to a .js file, and altered the upload scripts so that I could update that. But recently the diagrams that were still using the .gif file also stopped working for me in FireFox, and became active again when I changed them to use the .js file. The diagram creator now also will refer the .js file rather than the .gif file in the diagrams it creates.


Aurelian Florea wrote on Sun, Mar 5, 2017 06:19 AM UTC:

H.G.

Diagrams don't seem to work anymore, just code appears!


Aurelian Florea wrote on Mon, Oct 10, 2016 07:47 AM UTC:

You were correct,H.G., I did written royal=3 (as was my case) and I'm fine!


Aurelian Florea wrote on Mon, Oct 10, 2016 07:40 AM UTC:

Ok, thanks!


💡📝H. G. Muller wrote on Mon, Oct 10, 2016 07:39 AM UTC:

Ah, this is a consequence of the new way to handle the royal piece. The diagram must think Griffin and Queen are royal. By default the last-defined piece is royal. If you don't want that, you can add a line

royal=N

to the diagram definition, with N the ordinal number of the King.


Aurelian Florea wrote on Mon, Oct 10, 2016 02:49 AM UTC:

And the queen in small apothecary 2!


Aurelian Florea wrote on Mon, Oct 10, 2016 02:48 AM UTC:

I've noticed somthing odd with my diagrams for small apothecary 1 chess (the ones on my computer that use the javascript). The griffin, and griffin only shows grey pseudo-check moves. This can't be right and needs fixing.


Aurelian Florea wrote on Sat, Oct 8, 2016 03:51 PM UTC:

Thanks, It's nice to know for future projects!


💡📝H. G. Muller wrote on Sat, Oct 8, 2016 03:22 PM UTC:

I am not sure what you mean by 'Xiangqi-style rivers'. As for graphical representation, Xiangqi is played on grid-points rather than squares, and the diagram will never be able to do that, as it is just a HTML table with images in the squares and lines between the squares. So displaying a River is just a tiny detail of something it cannot do in the first place.

If you mean that you just want certain pieces to be limited to a fraction of the board, this is already possible. The latest .js script for the diagram checks if there exists a user-supplied function BadZone(file,rank,piece,color). If there isn't, it assumes any piece can venture anywhere on the board. But if there is, it only accepts moves where the fuction returns 0 for the destination square.

To indicate the zones by coloring of the board the user can similarly supply a function Shade(file,rank), which returns a color.

So to do Xiangqi (with a western-style board) the HTML page defining the diagram would need to contain the extra text

<script>
function BadZone(x, y, piece, color) {
  if(piece = ELEPHANT) return (color ? y < 5 : y > 4);
  // cases for King and Advisors
  ....
}
function Shade(x, y) {
  var color = 0;
  if(y > 4) color = !color; // board halves
  if(x > 2 && x < 6 && (y < 3 || y > 6) color = !color; // palace
  return color;
}
</script>

As for hexagonal boards: this is currently definitely not supported. It would not be totally impossible to support something close to it in the current framework, however. The board must be a HTML table, which means rectangular cells. But it is possible to have cells extend over more than one column in HTML. So by doubling the number of columns, and then alternately fuse odd+even or even+odd on different ranks, you would get a masonry-like pattern which should be close enough.


Aurelian Florea wrote on Sat, Oct 8, 2016 12:01 PM UTC:

All your work the passed weeks with the diagrams is great, but I must ask:

1.Do they support hexagonall mappings?

2.Do they suport Xiangqi style rivers?

I think the short answer to both questions is no. Any hope for these facilities soon?


💡📝H. G. Muller wrote on Fri, Sep 23, 2016 06:51 PM UTC:

I have added a nice improvement to the ShowMoves(N) function associated with the diagram. Before, this function used to show the moves of the Nth defined piece that was defined, on an empty board. And if you invoked it again for the same piece, it restored the original board position. So that you could attach it with an onclick="ShowMoves(N)" to a HTML element that describes the piece in your submission text, to make clicks on it interactively show the moves.

The new feature works for variants with Shogi-style promotions (i.e. where you defined a non-zero promoOffset P to relate each unpromoted piece N to a unique promoted partner N+P). When you invoke the function a second time with the same N it shows the moves of the promoted piece.  It only reverts to displaying the origial position when invoked a third time. For unpromotable pieces the second invocation already makes the board revert to the original position, as before.

In addition it now always shows the name of the piece it displays the moves of in the message above the board. A good place to see it in action is the Chu Shogi article.


Aurelian Florea wrote on Tue, Sep 13, 2016 07:38 PM UTC:

Now I can actually play games, thank you H.G., I see now how silly they look. Thank you very much! It's now getting late here. See you soon!


💡📝H. G. Muller wrote on Tue, Sep 13, 2016 07:37 PM UTC:

Must have been a copying error. I was just reformatting my earlier posting that showed the required HTML, adding borders and background coloring to it, but not changing anything substantial.


Aurelian Florea wrote on Tue, Sep 13, 2016 07:18 PM UTC:

It works now, have you done something HG? or I just copied stuff wrong the first time?


Aurelian Florea wrote on Tue, Sep 13, 2016 07:14 PM UTC:

It works great for the other game, the one with archbishops!


Aurelian Florea wrote on Tue, Sep 13, 2016 07:01 PM UTC:

The graphics are wrong, but the script works! For images it shows just cracked images!


Aurelian Florea wrote on Tue, Sep 13, 2016 06:42 PM UTC:

I solved it, for some reason using open office instead of notepad does that, now I'll try to paste my own code!


Aurelian Florea wrote on Tue, Sep 13, 2016 06:39 PM UTC:

Yes, I see the diagram there.


💡📝H. G. Muller wrote on Tue, Sep 13, 2016 06:35 PM UTC:

That is the correct response; it means it could read the file and inspect its contents. (It is not really a .gif file but a .js file that I renamed to .gif, because the CVP submission form did not allow me to upload .js files. So it is not surprising the Browser does not recognizeit as a valid GIF image file.)

That makes it strange that the text of the diagram description is not replaced by the diagram. Because this is what the JavaScript is supposed to do. I suppose you do see the diagram on the Elven Chess article on CVP, and on http://hgm.nubati.net/variants/elven ?


25 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.