Comments/Ratings for a Single Item
![Editor](/index/editor.gif)
If all else fails, you could try to completely re-initialize the Diagram: copy the definition back to where it originally was, modify it in the desired way, and call Init(). The original specification would be in diagDesc[0], and the HTML element where it was stored in diagList[0], so
diagList[0].innerHTML = diagDesc[0];
would restore the definition like it was loaded. You could append a line squareSize=... to the definition, which would overrule an earlier definition of squareSize. For the piece names it is probably easiest to change those afterwards in imag[n] than modifying their original definition.
I added a call to CreateBoard(0, 1)
just before Display()
, and it does resize the board, but now none of the pieces show up. So, I'm going to revert it back for the time being.
![Editor](/index/editor.gif)
The HTML table for the board (including style specifications for the size of the cells) is created in the HTML element with class="idiagram" when the page gets loaded, based on the variable settings resulting from the parsing of the description that initially was inside this element. To have later changes in the parameters describing the board (like number of files and ranks, square size, rank numbering, rim color, whole-board background image) take effect, you have to call CreateBoard(0, 1). (The 0 here indicates the Diagram number on the page, which starts counting at 0, top to bottom, so this assumes there is only a single Diagram on the page.)
Things like background color of the squares are applied during display of a new position, which can be ordered through calling Display().
So you would have to modify imag[n] for n=1 to nType, and set those to the required filenames (including extension, but without color prefix or directory path).
I used an alert to tell me the value of imag[1] and it said "Pawn.gif". So, I modified imag[1] through imag[6] to have the correct piece names without the prefix or path, as illustrated in my previous comment.
At this point, I have introduced theming. Each button now also changes the colors of the spaces. I've added the Utrecht set, and I tried to change the size by changing the value of sqrSize, but it didn't work. I didn't bother changing squareSize, since it just passes its value to sqrSize.
![Editor](/index/editor.gif)
OK, I see what you are trying to do now: change the pieces in a Diagram that already has been created through a button. The problem is that the definition lines for the pieces are processed when the Diagram is first created. At that time the field defining the image is stored in an array imag[], and suffixed with a dot and the graphicsType. The image URL is created at display time, by concatenating the graphicsDir, color prefix and imag[n].
So you would have to modify imag[n] for n=1 to nType, and set those to the required filenames (including extension, but without color prefix or directory path). In the articles where I used buttons to swicth the graphics (like Chu Shogi) I avoided that by making the root names for all piece sets equal, and distinguish them by white and blackPrefix.
Here's the solution I came up with:
<input type="button" value="Abstract" onclick="graphDir='/graphics.dir/abstract/';whitePrefix='W';blackPrefix='B';imag[1]='Pawn.gif';imag[2]='Knight.gif';imag[3]='Bishop.gif';imag[4]='Rook.gif';imag[5]='Queen.gif';imag[6]='King.gif';Display();">
<input type="button" value="Alfaerie" onclick="graphDir='/graphics.dir/alfaeriePNG/';whitePrefix='w';blackPrefix='b';imag[1]='pawn.png';imag[2]='knight.png';imag[3]='bishop.png';imag[4]='rook.png';imag[5]='queen.png';imag[6]='king.png';Display();">
<input type="button" value="Magnetic" onclick="graphDir='/graphics.dir/magnetic/';whitePrefix='W';blackPrefix='B';imag[1]='Pawn.gif';imag[2]='Knight.gif';imag[3]='Bishop.gif';imag[4]='Rook.gif';imag[5]='Queen.gif';imag[6]='King.gif';Display();">
<input type="button" value="Motif" onclick="graphDir='/graphics.dir/motif/';whitePrefix='W';blackPrefix='B';imag[1]='Pawn.gif';imag[2]='Knight.gif';imag[3]='Bishop.gif';imag[4]='Rook.gif';imag[5]='Queen.gif';imag[6]='King.gif';Display();">
I also tried using SVG pieces, but only the white ones would show up. Game Courier handles this by using the showpiece.php script, but Interactive Diagrams do not. In case you would like to do something to allow SVG images to work for both colors in an Interactive Diagram, I have left up the button for it, whose code looks like this:
<input type="button" value="AlfaerieSVG" onclick="graphDir='/graphics.dir/alfaerieSVG/';whitePrefix='w';blackPrefix='b';imag[1]='pawn.svg';imag[2]='knight.svg';imag[3]='bishop.svg';imag[4]='rook.svg';imag[5]='queen.svg';imag[6]='king.svg';Display();">
In an experiment I ran, I changed King to king in the 4th field. I had expected the King to show up for Alfaerie but not for the other sets. Instead, it did not show up for any set. Looking at the code, I saw I would also need to change the value of blackPrefix and whitePrefix. So, I got this far in finding a solution:
<input type="button" value="Abstract" onclick="graphDir='/graphics.dir/abstract/';whitePrefix='W';blackPrefix='B';Display();">
<input type="button" value="Alfaerie" onclick="graphDir='/graphics.dir/alfaerie/';whitePrefix='w';blackPrefix='b';Display();">
<input type="button" value="Magnetic" onclick="graphDir='/graphics.dir/magnetic/';whitePrefix='W';blackPrefix='B';Display();">
<input type="button" value="Motif" onclick="graphDir='/graphics.dir/motif/';whitePrefix='W';blackPrefix='B';Display();">
With this much, I tried the same experiment again, and the Kings showed up for Alfaerie but not for the other sets. If I knew what variables were used for the pieces names, I could change those too, and this solution should work.
That field is already providing the correct name for three sets, but the Alfaerie set uses lowercase names instead of mixed-case names, and I want all four piece sets to work. How can I make an Interactive Disgram support multiple sets that do not use the same basenames for the same pieces?
![Editor](/index/editor.gif)
@Fergus: Each piece line in the description consists of 5 or 6 fields, separated by colons. The 4th field contains the root name of the image file. This defaults to the piece name specified in the first field. To create the full filename it will be prefixed with the graphicsDir and the white/blackPrefix strings, and suffixed with a period and graphicsType.
All fields are case sensitive.
I set up the Interactive Diagram to use different piece sets, and it works for three of them, but the other one uses different file names for the pieces. How can I make it know which file names to use for this set?
![Editor](/index/editor.gif)
Zillions of Games should be considerably stronger than the Interactive Diagram, in most variants. Engines like Zillions or Fairy-Max typically search 7-8 ply, and examine 100K-500K positions per second, the ID only does about 1-5K positions/sec. More advanced engine typically reach 11-15 ply, Stockfish and the likes more like 20-30 ply.
Yet in some variants Zillions totally fails. There exists a Zillions implementation of Tenjiku Shogi, and it is not able to make a reasonable opening move no matter how long you allow it to think, while the ID is slow but plays sensible. I guess the algorithm for what to search in the ID is more stable.
The ID was not designed for strength, but as a nice sparring partner for a person that just learned the rules of the variant. But it would not play any moves that even a beginner would consider idiotic. (Like unforced sacrifices of a Rook for an obviously protected Pawn.) It will make tactical errors, but I tried to make those look human-like. By extending the depth for moves that a human would consider obvious (like capturing what attracts attention by moving, or playing a second move with a piece that you just moves, or which was discovered by that piece), but otherwise severely limit the depth to make it blind to what happens after 'non-obvious' moves.
After the previous game, I turned up the strength of the Interactive Diagram to its maximum value of 4 ply and ran another game against Zillions-of-Games at 1 sec/move. I let the ID move first again. The game lasted longer, but Zillions-of-Games still won. Since Zillions-of-Games works with number of seconds instead of number of ply, I assume it fits in as many ply as it can calculate in the time it takes, and this may vary with the power of the computer. While my current computer is over a decade old, it is still considerably faster than the Windows 95 computer I had when I first got Zillions-of-Games.
- c4 Nc6
- f4 e5
- fxe5 Qh4
- g3 Qe4
- Nf3 Nxe5
- Bg2 Nxf3
- Bxf3 Qxc4
- b3 Qd4
- Nc3 Bb4
- e3 Qf6
- Nd5 Qxa1
- Nxc7 Ke7
- Nd5 Kd8
- Nxb4 a5
- Nd3 Qxa2
- Nc5 Kc7
- Bd5 d6
- Nd3 Nf6
- Bf3 Be6
- O-O Bxb3
- Qe2 Bc4
- Bb2 Bxd3
- Qxd3 Qxb2
- Rb1 Qe5
- Rxb7 Kd8
- Rxf7 Rc8
- Rxg7 Rc1
- Kg2 Re8
- h4 h6
- Rg6 Rh8
- Qd4 Qxd4
- exd4 Ke7
- Rg7 Ke6
- Rg6 Rc2
- d5 Kf7
- h5 Rxd2
- Kh1 Rc8
- Bg2 Rc1
- Kh2 Rcc2
- Kh1 Rxg2
- Rxh6 Rgd2
- Rxf6 Kxf6
- h6 Rc1
Here is a game I ran between the Interactive Diagram on this page at 2.5 ply and Zillions-of-Games at 1 sec/move. Assuming that the Interactive Diagram would be weaker, I let it move first. My prediction proved correct, and Zillions-of-Games won.
- d4 Nc6
- c4 d5
- e3 e5
- Nc3 exd4
- Nxd5 Nf6
- Nxf6 Qxf6
- a3 dxe3
- fxe3 Bf5
- Nf3 Rd8
- Qb3 b6
- Bd2 Bc5
- Bc3 Qh6
- Bd2 Qe6
- Ng5 Qd6
- O-O-O Qe7
- Qb5 Rd6
- Nf3 Qe4
- Bd3 Qxd3
- e4 Bxe4
- Qxc6 Rxc6
- Ne5 Qc2
This is a freshly written Chess page using the membersubmissions forms. It may or may not eventually replace the other Chess page. I may add more details as time goes on, such as a section on notation.
15 comments displayed
Permalink to the exact comments currently displayed.
The author, Fergus Duniho, has updated this page.