At first thing, I'll attend WCSC22(The 22nd World Computer Shogi Contest) with NON-GPGPU program. It's not the part of this blog entry, but very, very important thing, so I've mentioned it before starting the today's blog entry.
* * * * * *
Today, I'd like to talk about UI interface of Mechawooser Shogi (Japanese Chess Playing Program) and their unique technologies that be used in this program.
Mechawooser shogi's UI is formed by Titanium Desktop technologies.
Especially for using Python language to communicate UI view and the "Think":
Alpha-beta based AI components.
Titanium Desktop is a kind of pretty little (but sufficient) webkit browser,
of programming language that be used within the Titanium Desktop is Python language!
Titanium Desktop environment can be used various programming language at a
same time within unique index.html (and imported program fragments also downloaded simultaneously).
Let's take watching inside structure of Mechawooser Shogi.
1. Communication routines for shogi server (like chess server) was already written by Python by using socket modules.
2. Write the Shogi board to index.html by using table environment, and manipulate
Shogi pieces by JQuery.
3. Communication routines wait for message from shogi server and throw the queue entry to the queue that is always polling in timer thread(interval = 100ms).
4. polling timer thread recognize the aim of queue entry and redraw the shogi board by using JQuery Commands.
5. Communication routines also invoke Think() function within the shared library.
In order to invoke Think() functions, we use ctypes module of Python language.
the ctypes library can invoke C-linkage functions within the Python Environment.
When Think() is returned the result (=the next move), Communication routines tell the next move to shogi server, and shogi server return the emission time, then queue entry of rewriting the shogi board is en-queued, and finally UI appearance is changed.