14 February 2011

ジョッグル

ワードハントでジョッグルを楽しめる!

周辺の文字を最低3文字繋げればポイントをゲットできる!

検索ボトンを押すと、すぐに英訳登場。楽しいゲームだけではなく、英語学習のツールとしても考えられる!

得点をお友達やグループメンバー等とフェイスブック、メール、ゲームセンターでシェアし、簡単に比べることができる!

広告は表示されません。


グラフィックス: Ray.

Jogguru iOS

Introducing Jogguru, the fast and fun way for learners of all levels to boost their knowledge of Japanese! Now available on the iTunes Store for the iPhone, iPod Touch and iPad on iOS3.0 and up.

✓ Hunt for hiragana words by connecting up adjacent letters
✓ Score points for words with 3 or more letters and complete achievements!
✓ Instant kanjis and English translations
✓ Features all JLPT N1-N5 vocabulary
✓ Share your words and scores with your friends on Facebook, on Twitter and by e-mail
✓ Post scores to Game Center and see how you progress with your friends!
✓ Tap て for て, again for で, and again for て. Cycle つ → づ → っ → つ
✓ Shake for new game
✓ No advertising

Developed in association with cooori: the future of language learning.

Graphic design: Ray.

09 February 2011

A Texas Hold'em 7-card evaluator: Part II.

(Part I is here.)

There are further significant performance gains to be had by exploiting thoughtful choices for the suit values.

We assign the integer values 0, 1, 8 and 57 for spade, heart, diamond and club respectively.

Any sum of exactly seven values taken from {0, 1, 8, 57} is unique among all such sums. We add up the suits of a 7-card hand to produce a "flush check" key and use this to find a precalculated flush suit value (in the case we're looking at a flush) or otherwise a defined non-flush constant.

The extraordinarily lucky aspect of this is that the maximum non-flush key we have, 7825759, is a 23-bit integer (note 2^23 = 8388608) and the largest suit key we find, 57*7 = 399, is a 9-bit integer (note 2^9 = 512). If we bit-shift a card's non-flush face value and add to this its flush check to make a card key in advance, when we aggregate the resulting card keys over a given 7-card hand we generate a 23+9 = 32-bit integer key for the whole hand. This integer key can only just be accommodated on a 32-bit system and yet still carries enough information to decide if we're looking at a flush and, if not, to then look up the rank of the hand.

We can therefore typically (about 97% of the time for a random hand) decide the rank of a 7-card hand with no more than six additions, as opposed to twelve (six for the flush check and another six for the rank key), extracting a performance gain in excess of 30%.

This optimisation features in Poker Ace 1.1 and later versions. It has also been implemented in the Objective-C, Java, C++ and Python versions of the open source code.

For what it's worth, with this optimization and some inlining I've seen the C++ version clock over 250M evaluations per second on my 2010 MacBook Pro.