Archive for the ‘Fun & Games’ Category

遊戲的極限

Friday, April 4th, 2008

在讀中學時,有一次負責學校 IT 的老師 (老實說,當時他幾乎不懂 IT 是甚麼) 看到我在電腦室裏開小差,偷偷地在玩接龍,他就告訴我他自己的經驗:為了不讓自己再心思思玩那些小遊戲,他的方法就是不斷拼命地玩,直到有一天覺得厭倦為止,那麼以後即使再怎麼想偷懶,也永遠不會再碰那些遊戲,省下很多時間了。

(more…)

Games on … (ahem) … Linux

Saturday, March 29th, 2008

Subscribing to HappyPenguin RSS feed might be an error. I just keep reading the same game descriptions over and over (and yawning). Finally, finding myself so bored, I decided to summarize the game descriptions. These patterns should fit more than half of all games listed in Happypenguin:

(more…)

My first Scrabble bonus score

Saturday, March 22nd, 2008

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.

Solving Kakuro with arithmetics (cont’d)

Friday, February 29th, 2008

As discussed in previous post, kakuro can be tackled using simple addition and subtraction during initial stage, particularly if the kakuro puzzle contains some certain arrangement pattern. As an example, see the figure below:

kakuro-example3.png

With arithmetics, one can deduce A=1 and B=3. This method, though less likely mentioned in general kakuro strategy guide, has been presented in Wikipedia page. Generally, this method is only usable when an area is enclosed, and there is only one single outlet among all those squares. In the above puzzle the outlet is square A. Thus such method is not useful in the next puzzle below:

kakuro-example4.png

Does it mean addition and subtraction will be completely useless then? Not entirely, depends on situation. Under rare circumstances, addition and subtraction might be useful even during mid-games or end-games. The diagram below shows the stage when large part of above puzzle is solved:

kakuro-example5.png

Here comes the tricky bit: concentrate on upper right area. We are not getting the value of a single square, not even sum of two squares, but three.

kakuro-example6.png

Take summation of all red squares horizontally, then deduct all deeper red squares vertically, one gets A+B+C=21. So what? 21-in-3 has too many combinations, and it’s still hard to try one by one. The key here is, value of A has great limitation. See the final figure below, and observe the square marked “x”:

kakuro-example7.png

Within the column with sum=32, there is a ‘2′, thus this column has only one single combination: (2,6,7,8,9), which means x=6 or 8 or 9. Is it true? No. If x=6, then A=6, and violates kakuro rule.

That means x=8 or 9, implying A=3 or 4. But recall that A+B+C=21. If A=3, then B=C=9, game over. So we get the answer: (A,B,C) = (4,9,8).

Solving Kakuro with arithmetics

Tuesday, February 19th, 2008

Sort of puzzled — I haven’t seen anywhere mentioning that some kakuro puzzles can be solved with the help of simple arithmetics (yet). Indeed I don’t mean the whole puzzle can be solved merely with addition and subtraction; nor do I mean every puzzle can be worked on this way. Arithmetics usually only works at the beginning, and only works with some kind of puzzles. Here is a simple example. Consider the following fragment:

Kakuro example

It’s solvable without any arithmetics; but hey, I’m just illustrating how to do it in other way, and (arguably) easier way. Look at the diagram below:

Kakuro example 2

Look at the 2 rows marked with green arrow, and 2 columns marked with cyan arrow. One get A + B = 22 + 8 - 11 - 7 = 12. Still, some more hints are needed. Now look at the column with sum = 35. Since 35 has only one combination (5, 6, 7, 8, 9), in order to pick 2 numbers out of these 5 and satisfying A + B = 12, viola, we have A=7 and B=5. Not hard, isn’t it?

2008-02-29: Next post on solving kakuro with arithmetics here.

十三番任食

Wednesday, November 21st, 2007
JAD 可以從 bytecode 完全還原所有程式碼的 indentation 和 comment;我真是一邊用一邊說多謝啊。 :-D

之前一直在研究某個網上麻雀遊戲的溝通和破解方法,因為只是從 sniffer 得出的 traffic 中理解,進展甚慢,只能勉強交談,很辛苦地才能玩一局(沒有 GUI)。但某一晚得到一個舊同事介紹 JAD 這個 Java Decompiler,開發進度即時有飛躍式的進展,更揭發了內裏不少暗秘。

  1. (未證實)登入麻雀遊戲時,該人是否 admin 只由一個數字控制,而且這個數字是由用戶端讀入 HTML 來控制的。如果使用 proxy 攔截 HTML,修改數字後才繼續載入……可想而知。人人可以做 admin。但即使不修改也可以,只要你的名稱是 “chua****” 一樣可以做 admin。
  2. 解讀程式碼後,發現一局牌食糊與否竟然是由用戶端決定的!!! 由這時開始,邪惡念頭不斷湧現……更要命的是,糟糕的情況和預計一樣。食糊的主要 logic 都是由用戶端計算的,伺服器只做一些很基本的檢查。於是出現下列的笑話:
  3. 何時食糊,可以全數由自己控制。例如我可以連續「食」50 局「天胡」。所謂「食糊」?

    不要看輕它,如果是東圈的話,這已經是兩番了!(自摸 1 番,東圈 1 番)你本身是東位的話,更變成三番!(有一隻東就已經是雙番東)看過的人都不禁會問:這算是打麻雀!?

  4. 平常打牌,到自己的時候就要摸一隻,然後打一隻出去的。但是在這個網上麻雀創造了新的方法,就是可以連打 12 隻然後摸回 13 隻,最後才打多一隻出去!更甚的是,不一定要打那麼多隻,多少隨意,小相公大相公也沒問題,只是這兩種不能食糊。(遇到大小相公,到自己的時候多打/多摸一兩隻牌就自然沒事了)
  5. 可以亂打牌,隨之而來就更加貪得無厭了。覺得只是一到自己就食糊不夠過癮?更過份的還未說呢!假設自己摸的一手牌是這樣:

    到自己的時候,可以連續將索子、筒子和紅中全部連續打出來,剩下:

    這個不是東西?錯了!五隻都是萬子,所以是清一色!盛惠 7 番!

  6. 上牌要靠上家嗎?非也!在這個網上麻雀可以不靠上家。輪到自己的時候,在自己的牌中隨意抽三隻上也行。例如:

    死未!

  7. 兹舉更邪惡的例子如下:

    如果將萬子索子筒子都一口氣扔掉呢?

    嘿嘿嘿嘿。字一色、混老頭、對對糊、紅中、發財、白板、白摸。

    • 單就這五隻來說,的確只是字牌,符合字一色條件。
    • 混老頭也一樣,整手牌只有字牌和么九便算是混老頭。
    • 因為有一對北,所以是對對糊 (!)
    • 有紅中就自動當是碰紅中,加一番,發財白板一樣。

    多少番?不數了,反正該網上麻雀最多只能食 13 番。

都要怪 JAD,令我對編寫相關的程式興趣大減了。寫些有用的程式好過。香港的 programmer 啊…… 該鞭屍嗎?

明報的水準真是不太行

Tuesday, July 31st, 2007

明報的記者原來連甚麼是 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。