Here a list of pdf-files of NeverEndingBooks-posts on games, in reverse chronological order.
Posts Tagged ‘dvonn’
NeverEndingBooks-games
Wednesday, June 13th, 2007mathML and work ahead
Thursday, February 8th, 2007It has been a difficult design decision, but I‚Äôm going to replace the LaTeXRender Wordpress Plugin for mathML as the default TeX-interface for NeverEndingBooks. I will keep LaTeXRender on standby as I may have to use exotic packages or commands that iTeX does not deliver, but for most math-related posts, MathML will do the job nicely (as the n-category cafe shows every day (or even more often)). Not that I stopped being a dilettante but I’m going to do most of my writings (including blog-posts) using Scrivener (more on this another time) and Scrivener supports MultiMarkdown and allows exporting to LaTeX and XHTML (using MathML).
I could never have pulled this off in such a short time without Jacques Distler more or less on constant stand-by (thanks Jacques!). Looking at the times his emails were send I have no idea in which time zone he lives (let alone sleeps…). So, here a walk-through the changes :
As I’m on WP 2.0.5 I’ll start with Frederick’ post. He tells me I have to install first the itex2MML binary as explained by Jacques but I find that there is more recent material and therefore download the most recent imath2MML-package and follow the readme. There is a Mac OSX binary but it’s not clear for what processor (PPC/Intel/Binary) but a quick mail to Jacques learns me that it’s PPC which is fine by me but on the spot he puts a universal binary online, so whatever your Mac is you can just download the binary, copy it to /usr/local/bin and make sure its chmodded 755.
Back to Frederick’s post, download and install the plugin itexToMML.php in the usual way (fortunately I spot just in time that I have to change one line saying where my itex2MML binary is (in Frederick’s file it is NOT the default location)). You can verify whether the plugin and itex2MML do what they are supposed to do by typing a LaTeX-command in a post and save it. The output will not produce the desired formula but have a look at the source file and see whether there is some mathML code in it. If so, fine! If not, go back and check everything.
If this works, it is “merely” a problem of getting your mathML served. Frederick suggests to unpack wordpress_mathML.zip in the wp-includes directory (but you better make sure you have made a copy of the original class.php and functions-formatting.php files. In the end I decided against this approach (that is, to replace only the functions-formatting.php but NOT the class.php file). If you have two or more themes you want to maintain, it is probably better to change the headers (because this is what we have to do to get mathML served) only in those themes which are XML-sound. In my case, the Command Line Interface theme most certainly is NOT!!!).
Go to your theme-files and look for the header.php (or similar) file and replace the default header by the code in the addendum to this post within php-tags. If you can go to your blog-page then you are in good shape and things should work well (apart possibly from layout considerations, see below). Of course, in my case i was greeted by ” XML “yellow screen of death” (as Jacques calls it) and I was convinced I did something wrong, so I tried out several useless things for a couple of hours before it dawned on me that the reason might just be that my blog-files were not valid XHTML (and the new headers are very demanding on serving only well-form XHTML). I had to modify all changes I made to sidebars etc. as well as rewrite parts of my first posts (I used to take a rather liberal view on writing blog-posts, writing a mixture between Markdown and improvised HTML and in the process was very lax about closing IMG-tags and the likes). But after some time and numerous corrections to the files I got the main-page up and running (and even had the mathML served as a readable formula) apart from the fact that I barely recognized my own site.
I printed out source files of the page with and without changed headers and couldn’t find a difference. So, it had to do with the CSS-style files, but why on earth would the new headers be picky about CSS? But as a last resort, after narrowing the search down to one CSS-line, I asked Jacques whether he had an idea what went on. His reply will be remembered for quite some time :
A fascinating question. The answer is that it is following the CSS directive, but in XHTML, ‘body’ is not what you think it is. ‘body’ is just big enough to contain its content. It does not fill the viewport. ‘html’ fills the viewport. The solution (a solution) is described in
http://golem.ph.utexas.edu/~distler/blog/archives/000203.html
Many hours later, I still haven’t got a clue what this is all about, but I blindly followed the hint and surely all problems vanished. In short, another day wasted in front of a computer-screen.
At the moment I’m back to old headers and will not be writing mathML for some time as I have the vast job ahead to validate all my previous posts to XHTML-standards (if not you would see more yellows screens of death than anything else. So, here‚Äôs the strategy I’ll be taking in the weeks ahead (I’ll sleep on it tonight so if any of you think there is a better way, reply quickly)
- rewrite each and every post in proper MultiMarkdown using iTeX for the most common math and only resorting to LaTeXRender for exotic things (such as Sudoku, Chess, Dvonn) and run these posts through Markdown (to get basic HTML and all links in place).
- download these files to the WP-database (so that in the CLI-interface you will be able to follow all links, but will read all iTeX as TeX-commands (as the command line intended after all).
- in the process change all broken links to the default permalink-structure (with index.php?p=231 or so).
Clearly, this is a work that will take a couple of weeks but it may be fun to reread these old posts and possibly add new information about the subjects. When I’m making these changes, I’ll use the new headers so if you are using a smart browser look out for the yellow screens. When they happen, either use a dumb browser (such as Safari) or go into CLI-interface mode where everything should still work. I plan to start with the oldest posts as this seems more fun to me.
dvonn (2) overload
Wednesday, January 11th, 2006In the previous post we have seen that it is important to have lots of mobile pieces around in the endgame and that it is hard for a computer-program to evaluate a position correctly. In fact, we illustrated this with a position which ‘clearly’ looks much better for Black (the computer) whereas it is already lost! In fact, the computer lost this particular game already 7 plies earlier. Consider the position
Probably, Black lost the game with its last move d1-f3 thereby disconnecting its pieces into two clusters. White (the human player) must already have realized at this moment he had a good chance of winning (as indicated in the previous post) by letting Black run out of moves by building large stacks on the third row, White building a stack of the appropriate size which then jumps on the largest Black stack on the final move. Btw. this technique is called sharpshooting in Dvonn-parlance
The concept of manipulating the height of a stack so that it can land precisely on a critical space. It’s a matter of counting and one-digit addition. Notice that this doesn’t necessarily mean putting your own stacks atop one another - the best sharpshooting moves are moves which also neutralize. To counter a sharpshooting move is called “spoiling”.But for this strategy to have a chance, White must keep the Black stacks containing the Dvonn pieces on the third row. At the moment the stack on c3 can move to c1 or to c5 and with his next move White counters this by overloading the stack, that is
To spoil a move or prevent a lifting move by moving atop the enemy stack. Even if the opponent has enough control to retake the stack, he cannot move it because it has become taller.So, White sacrifies his height 4 stack on g3 with the move g3-c3. Black must take back immediately (if not, White moves c3-i3 and all Black’s material in the farmost right cluster is lost) but now the previously mobile Black height 2 stack at c3 has become an immobile (or old stack) height 7 stack which has no option but to stay on c3 (clearly Black will never move it to j3…). Next, White performs a similar startegy to neutralize the young height 3 Black stack on f3 by overloading it by 2 and hence after the forced recapture it becomes a height 6 Black stack which must remain on f3 forever. Here are the actual moves 1) g3-c3 b2-c3 2) h2-h3 b4-c5 3) h3-f3 e2-f3 and we end up with the situation we analyzed last time, that is
Latexrender and dvonn boards
Monday, January 9th, 2006In order to blog a bit about Dvonn-strategy, I made myself a simple Dvonn LaTeX-template which works very well on paper but which gets mutilated by Latexrender, for example the first situation of the looks like
The reason behind this unwanted clipping is that Latexrender uses convert to take the relevant part of a ps-page containing only the TeXed formula on an empty page by performing clipping and then converts it into a GIF-file (or any other format you desire). The obvious way round this is to enlarge my template by adding two additional rows and columns and putting visible nonsense there (such as dots) to enlarge the relevant part so that no clipping is done of essential info. But then (1) the picture generated becomes even larger than that above and (2) I don’t want you to see the extra nonsensical dots… The essential line in the class.latexrender.php file is
$command =
$this->convertpath.” -density “.$this->formuladensity.
” -trim -transparent \”#FFFFFF\” “.$this->tmpfilename.”.ps “.
$this->tmpfilename.”.”.$this->imageformat;
So
I needed to delve into the manual pages for the convert command of the ImageMagick-package. To my surprise, the -trim option (which I thought to adjust somewhat by adding parameters) doesn’t exist! Still, I got around my second problem using the crop option and around the first by using the very useful geometry option. The latter is also useful if you find that the size of the output of Latexrender is not compatible with the size of your regular text. Of course you can amend this somewhat by using the extarticle documentclass (as suggested) but if you want to further adjust it, use for example
-geometry
86%
to size the output to exactly 86% (or whatever you need). So, whenever I want to do some Dvonn-blogging from now on I’ll change my class.latexrender.php file as follows
$command =
$this->convertpath.” -crop 0×0-10% -crop 0×0+10% -density
“.$this->formuladensity. ” -geometry 80%
-transparent \”#FFFFFF\” “.$this->tmpfilename.”.ps “.
$this->tmpfilename.”.”.$this->imageformat;
which produces the output
which (I hope) you will find slightly better…
dvonn (1) mobility
Saturday, January 7th, 2006Dvonn is the fourth game in the Gipf Project and the most mathematical of all six. It is a very fast (but subtle) game with a simple set of rules. Here is a short version
DVONN is a stacking game. It is played on an elongated hexagonal board, with 23 white, 23 black and 3 red DVONN-pieces. In the beginning the board is empty. The players first place the DVONN-pieces on the board and next their own pieces. Then they start stacking pieces on top of each other. A single piece may be moved 1 space in any direction, a stack of two pieces may be moved two spaces, etc. A stack must always be moved as a whole and a move must always end on top of another piece or stack. If pieces or stacks lose contact with the DVONN pieces, they must be removed from the board. The game ends when no more moves can be made. The players put the stacks they control on top of each other and the one with the highest stack is the winner. That’s all!All this will become clearer once we fix a specific end-game, for example
with White to move. Some comments about notation : the left-slanted columns are denoted by letters from a (left) to k (right) and the rows are labeled 1 to 5 from bottom to top (surprisingly this ’standard’ webgame-notation differs from the numbering on my Dvonn-board where the rows are labeled from top to bottom…). So, for example, the three spots on the upper right are k3,k4 and k5 (there are no k1 or k2 spots). The three Dvonn pieces are colored red and in the course of the game a stack may land on a Dvonn piece and so stacks containing a Dvonn piece are denoted with a red halo. For example, the symbol on spot f3 stands for for a stack of 6 pieces, one of which is a red Dvonn piece, under the control of Black (that is, the top-piece is Black). Further note that a piece or stack can only move if it is not surrounded by 6 other pieces or stacks (so the White pieces on j3 and j4 cannot (yet) move). A piece can only move by one step in either line-direction provided there is another piece or stack on that position. The same applies for stacks : an height 3 stack for example can move in each lin-direction by exactly 3 steps provided there is a piece or stack to jump onto. For example, the height 6 stack on d4 can only move to j4 whereas the height 6 stack on f3 cannot move at all! Similarly, the two black height 5 stacks are immobile. At the moment black has all its stacks defended, that is, if White should be able to jump onto one of them (which White cannot at the moment), Black can use one of its neighbouring pieces to take the stack back under its control. So, any computer program would ‘evaluate’ the position as favourable for Black : Black has stacks of total height 34 safely under control (there are no immediate threats to be seen : the horizon effect in such programs) whereas White can only claim potential stacks of total height 13… Still, Black has already lost the game. White has more pieces which are quite mobile as opposed to the immobile black stacks, so Black will soon run out of moves to make and his end position will have some large stacks on the third row. All white has to do is to let Black run out of moves and then continue (Dvonn forces each player to make a move if they still can and to pass the move otherwise, so the most mobile player can still continue long after the other player was forced to stop) to build a White stack of the appropriate height on the third row to jump on the highest Black stack with its last move! Here is how the play continued : 1) j2-k3 ; a3-b3 2) i1-k3 ; c5-c3 3) i2-i3 ; c2-c3 4) i3-k3 ; d4-j4 5) j3-j4 ; e3-f3 6) i4-j4 ; c4-b3 to arrive at the position where Black is no longer able to make any moves at all
Note that all pieces and stacks no longer connected to a Dvonn piece must be removed. So, for example, after the third move by Black, the Black height 5 stacks on c1 was removed. All white now has to do is to built an height 8 stack on k3 and jump onto the height 10 Black stack on c3 to win the game. The (only) way to do this is by 7. j5-k5 and 8. k5-k3 to finish with 9. k3-c3 with final position (note again that the White right-hand pieces and stacks are no longer connected to a Dvonn piece and are hence removed)
So White wins with 18 to Black’s 15. This shows that it is important to maintain mobility and also that it is possible to win a Dvonn-game from computers. In fact, the above end-game was played against a computer-program (Black). The entire game can be found here .