Posts tagged ‘board game’

So long, Quarry

2008-08-12

安息吧。

總覺得有點可惜,因為 Quarry 是我見過的棋盤中寫得比較好的(對用家來說,不是裏面的 code),而且可以作為多種棋盤使用。圍棋可以用 gnugo 和人對戰,也可以兩個 gnugo 自己來,更可以人手編輯棋局;蘋果棋(黑白棋)則有 grhino,一樣地使用。

Quarry: screenshot for Go (game start) Quarry: screenshot for Reversi

但我不知為何作者不在網站中聲明自己已經放棄維護它,現在的網站有點誤導,令人以為它還有 0.3 版本。 :-(

2008-08-16 編輯:還以為 Quarry maintainer 沒理我,原來是我的郵件未通過 mailing list,怪不得沒反應。現在網站上已經反映實際情況了。

My first Scrabble bonus score

2008-03-22

Using all tiles in Scrabble

This is my first time to get the 50 point bonus (despite having played Scrabble since early secondary school day) without any sort of ‘cheating’ — earlier days I have been able to get that bonus, but with great sacrifice — think of a fixed word, keep playing one or two tile everytime, till I get all the tiles I want. Yes, the score isn’t that high (only 84, after counting bonus), but enough to keep me happy for a while.

明報的水準真是不太行

2007-07-31

明報的記者原來連甚麼是 chess,甚麼是 checker 也不知道。初時看一看這篇明報的報導

加拿大科學家用了18年時間,發展出一套完美西洋棋的電腦程式,……

這時已有點驚奇,因為在現代來說應該還是不可能的,但它還拿深藍來比較啊。再去 Slashdot 看一看

My story on the Nature site announced that a team of computer scientists at the University of Alberta has solved checkers.

兩者必有一者錯了。就算 Slashdot 的品質如何差,鬼佬也不至於會將 chess 和 checker 搞錯吧。於是上 Chinook 的 site 看一看,果然是 checker。

棋賽也出千

2007-01-19

平常只有賭場才會常有高科技出千,現在這種風氣竟然曼延到棋賽了。現在還是國際象棋,何時輪到中國象棋?雖然中國象棋的棋手現在大多都沒錢買這種玩意,但難保將來沒有。

My chess project

2006-11-02

This thing starts to be (barely) playable:

XQboard XQboard

Really glad that I managed to do something, despite my health deteriorating sharply because of it. (Cough, cough, …)

However the whole project is far more complex than I have thought. Only after starting coding for a while that I found existing protocol definition between chess engines and boards, namely “cxboard” and “UCCI” protocol, akin to xboard/WinBoard and UCI protocols. What it means to me is, one single project becomes two!

There are only very few existing open source implementations of Chinese Chess (XiangQi):

Name Type Comment
MRSD+ (夢入神蛋) engine + board Strong AI, dead project (since 2003), UI and engine not separable (i.e. no communication protocol)
ElephantEye (象眼) engine Strong AI, actively developed, supposed to be UCCI reference implementation
CXBoard board Feature rich, uses GTK+ 1.2 (old), doesn’t support newer cxboard protocol in spite of its name
JunFa engine Supposed to be the reference implementation of cxboard protocol. Guess what — one can capture all of the opponent’s 16 pieces in the first 16 moves with one single pawn. Only supports a few commands in cxboard protocol.
QiPan board Uses Qt 2.x (not available on most Linux now), better support of cxboard protocol, can’t test because I can’t compile it
tsito engine Only supports old cxboard protocol, very weak AI
VSCCP engine Only intended as a coding sample, very weak AI

Until today, the route chosen is: (1) separate the engine part of MRSD+ into a command line interface, which is not so hard, thanks to Wei Tzer Jen implementing the AI as a C++ class; (2) write a GTK+2 frontend, as I have (psychological?) problem learning any OO language.

However when I found Elephany Eye to be compilable on Linux without problem, seems it’s time to switch strategy: using existing, working engine is far better than modifying one not working well. So most likely I’ll make sure it is playable with Elephant Eye first, only work on MRSD+ if there is any spare time.

Anyway, this stuff is still far from release quality — lots of variables and memory leaked globally, even more variables hard-coded, etc. Much more time is needed to clean up all of these, not to mention all of the TODOs below:

  • Make preferences work
  • Allows taking back moves
  • Allows engine playing either side (right now hard-coded to black/blue side)
  • More complete cxboard implementation
  • Implement UCCI protocol support
  • Compile with autotools (though I know this toolchain sucks)
  • Some artwork (EEEK, I never mean doing it myself)

And the long term plans:

  • Two engine mode
  • Implement chess clock
  • Implement proper game history navigation
  • Turn the board into a full featured widget
  • Implement import and export of PGN or XGF or whatever format invented in universe
  • ……
  • …………

In the process I found Quarry to be very helpful as a reference, IMHO it is one of the best implementation of game boards, fully widgetized and controllable in great detail, not to mention its capability in handling various kinds of game board (Go, Amazons and Reversi) in a single program.

About releasing, my best guess is that it can at least compile and run properly on, say, 2-3 weeks later, since I need to go to Beijing for a job interview recently, thus unable to work on it for a few days. Please forgive me if anybody thinks my code is as ugly as food dipped in shit — I’m just an absolute beginner in programming, especially on working at larger scale program. Yes, that’s not a joke, perhaps I can read a bit of code, but have almost never been a coder myself before.

Currently there are a few areas where help is needed:

  1. Public source code repository. Is sourceforge a good idea? Or should I set up my own subversion/cvs?
  2. Somebody care to teach me on stuff about widget and signals? :-D
  3. Artwork (right now most of the things are shamelessly ripped off from Quarry and MRSD+)

近來搞的小 project

2006-10-24

在可見的將來,我都要面對類似以下的程式碼:


int XQ::pidS(int t,char c)
{
int n,s,e,i,j,j0,j1,j2,cmp=-1;;
s=24+Turn();
e=32+Turn();
if(c<='9'  && c>='1')
{
         if(Turn()) n=c-'1';     else n='9'-c;
for(i=s;i<=e;i+=2)
if(YX_X(cch_p[i])==n) {return i;}
return s;
}
if(c>='A' && c<='E')
{
n=c-'A';
for(i=8;i>=0;i–)
for(j=9;j>=0;j–)
if(bd(j,i)>=s)
 if(bd(j,i)<=e)
 if((bd(j,i)&1)==Turn())
{
if(n==0) return bd(j,i);
n–;
}
return s;
}/*A-E*/
#define CMP_SWAP(a,b) if(YX_Y(cch_p[a])<YX_Y(cch_p[b])) {j=a;a=b;b=j;}
j0=-1;
j1=-1;
j2=-1;
for(i=s;i<=e &&j0==-1;i+=2)
  for(j=i+2;j<=e;j+=2)
  if(YX_X(cch_p[i])==YX_X(cch_p[j]))
  {   if(j1==-1){  j0=i;        j1=j;}
  else {j2=j;跳出;}     }
if(j2==-1) j2=j1;
CMP_SWAP(j1,j2);
CMP_SWAP(j0,j1);
CMP_SWAP(j1,j2);
cmp=-1;
if(c=='+' &&!Turn()) cmp=1;
 if(c=='-' &&Turn()) cmp=1;
 if(cmp==1) return j0;
  return j2;
}
static char translate_c2e(char *c)
{
int i;

感覺就像要看懂 Google 的 Javascript 一樣:

  1. 大堆像 i, p, k, n, syx, dyx, cch_p 等等不知是甚麼東西、甚麼用途的變數名稱,就好像是曾經用過 code obfuscator 處理過,為了保存甚麼商業秘密似的。
  2. 每行都可以隨機地出現由一至四個不等的空格、tab 組成的縮排,甚至每行都可能會反向縮排,例如 if/else 中間的內容可以隨時在 if 左面、右面,或者在同一行。個個檔案都可以不一樣,甚至同一個檔案內各處也不一樣。
  3. 隨了縮排不計算,其它正常需要的空格全部不見了,就好像為了要慳位置似的,我說像 Google 的 Javascript 就是這個原因。

真的,不是 wordpress 排版錯誤,我已經努力確保所有空格、縮排位置和原來的程式一模一樣。唯一有改動的,就是程式本來有 Big5 碼,我將那兩個字改為用 UTF-8 碼而已,否則在 wordpress 就看不到了。會使用中文來當程式碼來寫,還是 C++,沒錯,這些中文程式碼就是丙正正遺留下來的餘孽。別的中文化程式語言也落得一樣下場,即使是當年「風頭一時無兩」的中蠎(中文 python)也不例外。這種中文化根本就是為了起長城,將中國人的腦袋和外面的世界隔絕,推廣方面也完全沒有半點好處,更不見得這種東西比英文易理解。

面對這些程式,我只能喊:

救命。

可能是因為當初魏澤人想也沒想過會有人想看、想改他的東西,所以就不需要用別人也能理解的方式去寫吧。但對於我這個入門的新手來說,真是頭痛得不得了。

另一樣更麻煩的,就是夢入神蛋是用 C++ 寫的,但我暫時又只懂用 C(以前學過的 C++ 都原封不動還了給教授),所以或許我只能將 engine 部份加個 command line frontend,然後和 GUI 之間用 socket 溝通也好,別的甚麼方法也好,總之是不能混在一起。其實這種做法和別的國際象棋做法一樣,如果能支援 GTP protocol 就最好,但短期目標 — 起碼要能夠用吧。對於我這個沒怎麼接觸過稍大一點的程式的人來說,距離這個目標還差得太遠了。

等能夠見人的時候才拿出來吧。現在以我的功力,寫出來的東西真是笑壞人肚皮……

Gnome Games change

2006-10-06

It’s more or less official: after voting, it is decided that glChess and Gnome Sudoku should replace Ataxx in future release of gnome-games.

It is unknown to me that glChess is still there, and still somewhat active. The last time I heard (and try) it was on around 2002 — at that time it looks like a dead project to me, although I like the full screen rendering of OpenGL chess board. I don’t know until now that the development restarts on around 2005, and is rewritten to use GtkGlExt. Some fresh air, nice. I’m eager to see how far it goes.

In contrast, Gnome Sudoku is not dead for such a long time; its development stalled for a while during 0.3.x days, but after hearing it will be picked as a member of gnome-games, I’m sure its maintainer will put more time on it. Besides, the only lacking components for Gnome Sudoku is accessibility and documents. This is absolutely a good addition.

So that means people shall say bye-bye to Ataxx. To me it’s not a bad game, and so far I only manage to get even with the hardest AI. Probably users are less familiar with this game and there is no quick visual guide to tell players how to play, so they vote against this game. I’ll miss it.

It is a good sign to see that gnome-games is not as dead as it used to be, since Gnome 1.x days. No new games, just polish bit by bit, without any surprise. What users care is ‘playability’, not about whether a grid can be resized or not, though that’s a minor plus. To players, a good arcade/puzzle game = good game flow + easy control + lots of variation (+ nice graphics/sound). IMO previous maintainers are just overengineering it without adding any value to the overall game suite.

Put it bluntly, they have been isolating themselves from users and ignoring users, and playing their own enginerring game just to satisfy their own coding desires.