Radjaïdjah Blog

jeudi 18 février 2016

Mental Poker

Playing mental poker is a difficult problem for a number of reasons. The foremost reason is that it is impossible, a result due to Shamir, Rivest and Adleman[1].

G.R. Blakley and D. Chaum

During Lift16, Ethereum / Consensys presented a number of very promising projects.

Almost all of these projects are based on a mysterious entity called the blockchain. More precisely, not the Bitcoin blockchain, but a private blockchain called the Ethereum blockchain.

Then was a gambling-related project: etherPoker.

etherPoker is advertised as a blockchain-connected provably fair online poker game. The underlying mechanism is based on mental poker, a term coined by RSA's creators, Ron Rivest, Adi Shamir, and Leonard Adleman.

Provably fair dice, a popular extension of online coin-flipping (bit commitment) works as such:

  1. a server seed is generated and its hash is provided to the client
  2. the player inputs a client seed
  3. a nonce (number of times that the server seed has been used) enters the game
  4. the player chooses a winning range
  5. a magic number deterministically created from the server seed, the client seed, and the nonce is computed
  6. if the magic number falls in the winning range, the player wins
  7. the nonce is incremented for the next round
  8. the player can verify his numbers by asking the server to reveal the server seed

In poker, an algorithm for shuffling cards using commutative encryption would be as follows:

  1. Alice and Bob agree on a certain "deck" of cards. In practice, this means they agree on a set of numbers or other data such that each element of the set represents a card.
  2. Alice picks an encryption key A and uses this to encrypt each card of the deck.
  3. Alice shuffles the cards.
  4. Alice passes the encrypted and shuffled deck to Bob. With the encryption in place, Bob cannot know which card is which.
  5. Bob picks an encryption key B and uses this to encrypt each card of the encrypted and shuffled deck.
  6. Bob shuffles the deck.
  7. Bob passes the double encrypted and shuffled deck back to Alice.
  8. Alice decrypts each card using her key A. This still leaves Bob's encryption in place though so she cannot know which card is which.
  9. Alice picks one encryption key for each card (A1, A2, etc.) and encrypts them individually.
  10. Alice passes the deck to Bob.
  11. Bob decrypts each card using his key B. This still leaves Alice's individual encryption in place though so he cannot know which card is which.
  12. Bob picks one encryption key for each card (B1, B2, etc.) and encrypts them individually.
  13. Bob passes the deck back to Alice.
  14. Alice publishes the deck for everyone playing (in this case only Alice and Bob, see below on expansion though).

To play poker with bitcoins, the new Seals With Clubs poker site is: SWCpoker.

To play for fun, download PokerTH (Radjaïdjah Blog's alias: BluffBluff).


[1] A. Shamir, R. Rivest, and L. Adleman, Mental Poker, Technical Report LCS/TR-125, Massachusetts Institute of Technology, April 1979

mardi 8 décembre 2015


Un des symboles communément associé à Hanoucca (fête des lumières) est la toupie (en hébreu : סביבון, sevivon), et plus particulièrement le dreidl.


Un dreidl est une toupie à 4 faces (mathématiquement, un 4-dé), où sur chaque face est inscrite une lettre hébraïque. Ces quatre lettres sont נ (noune), ג (guimel), ה (hé) et ש (chine). Elles constituent les initiales de la phrase :

נס גדול היה שם

qui se prononce "Nes Gadol Haya Cham", et qui signifie "un grand miracle a eu lieu là-bas".

Sur les toupies distribuées en Israël depuis 1948, le chine est remplacé par un פ (pé) et la phrase devient

נס גדול היה פה, "Nes Gadol Haya Po", qui signifie "un grand miracle a eu lieu ici".

Le classique jeu de Dreidl se pratique avec les règles suivantes :

  • Tous les joueurs débutent avec le même nombre de jetons/pièces/bonbons (en général entre 10 et 15).
  • Au début de chaque tour, chaque joueur place un ante d'un ou deux jetons au centre (pot commun)
  • Chacun leur tour les joueurs lancent la toupie, et en fonction du résultat doivent recevoir ou donner des jetons au pot. Plus précisément :
    1. נ (noune) -> le joueur passe son tour
    2. ג (guimel) -> le joueur ramasse tout le pot, et chacun replace un ante pour un nouveau tour
    3. ה (hé) -> le joueur prend la moitié du pot
    4. ש (chine) -> le joueur doit placer un jeton dans le pot
  • Le vainqueur est le premier à récolter tous les jetons.

Magie, le lien entre les lettres et les actions en découlant peut se retrouver via le yiddich : en effet

  1. נ (noune) correspond à nischt (rien), en allemand moderne : nichts
  2. ג (guimel) correspond à gants (tout), en allemand moderne : ganz
  3. ה (hé) correspond à halb (moitié), en allemand moderne : halb
  4. ש (chine) correspons à shtel ayn (dépose), en allemand moderne : stell ein

Il existe des versions plus modernes du jeu, dont le Texas Dreidel, combinant Dreidl et poker Hold'em.

Un commentaire du midrach relate que les quatre faces du Dreidl peuvent être associées aux quatre royaumes s'opposant au peuple juif[1] :

  1. נ (noune) correspond à Nabuchodonozzor (Babylone)
  2. ג (guimel) correspond à Gog (Grèce)
  3. ה (hé) correspond à Haman (Perse)
  4. ש (chine) correspons à Séir/Esaü (Rome)

Pour finir, ceux qui ont lu l'article sur les pierres précieuses dans la torah se souviendront de l'aspect messianique du serpent. Concernant Hanoucca, on relèvera simplement que נגהש a pour guematria (valeur numérique) 358, soit celle de... משיח !

Sources :
Amy Scheinerman, How to play Dreidl
Rabbi Yaakov, Secret of the Dreidel

חנוכה סמח


[1] Evidemment, il existe une autre interprètation qui affirme que les lettres sont à mettre en rapport avec Nefech (l'esprit), Gouf (le corps), Hacol (la totalité), et Sekhel (la sagesse), qu'ont attaqués respectivement Babylone, la Perse, Rome, et les Grecs.

vendredi 20 mars 2015

Le Noble Jeu

Comment rendre visuellement intéressant des jeunes assis à une table, qui bougent très peu et ne se parlent même pas?

Le défi a été de rendre un championnat d’échecs palpitant, retranscrire l’excitation des joueurs dans mon film. La clé a peut être été dans la façon de filmer les visages des joueurs en train de réfléchir. Ils ne bougent quasiment pas mais à l’image du poker, ils se trahissent par leur langage corporel.

Un documentaire visionnable sur le site de son créateur Romain Menu.

source : Europe Echecs

jeudi 15 novembre 2012

Can one grow intuition?

This is the 100th entry on the blog! Cheers!

After the 2012 US elections, statistician Nate Silver has known his fifteen minutes of fame when it appeared that his predictions regarding the results had been fulfilled despite the strong opposition by a good number of opponents.

Now, the same Nate Silver had previously authored The Signal and the Noise - Why so many predictions fail, but some don't, where he reports an anecdote about the 1997 Kasparov vs Deep Blue match (mentioned in the entry about the future of information science).

Nevertheless, there were some bugs in Deep Blue’s inventory: not many, but a few. Toward the end of my interview with him, [Murray] Campbell somewhat mischievously referred to an incident that had occurred toward the end of the first game in their 1997 match with Kasparov. “A bug occurred in the game and it may have made Kasparov misunderstand the capabilities of Deep Blue,” Campbell told me. “He didn’t come up with the theory that the move it played was a bug.” The bug had arisen on the forty-fourth move of their first game against Kasparov; unable to select a move, the program had defaulted to a last-resort fail-safe in which it picked a play completely at random. (...) Kasparov had concluded that the counterintuitive play must be a sign of superior intelligence. He had never considered that it was simply a bug.

Years later, at a authors@google talk interesting to have a look at in its entirety, Garry Kasparov (whose famous game against Topalov can be seen here) is asked if he relies on intuition to make decisions in chess[1]. His answer:

It's the most valuable quality of a human being in my view. Yeah, it's probably... we live at a time when we just want to touch something before we can make our opinion about the subject. I believe that intuition is like any other muscle. So, like people know that if you go to the gym you improve your physical conditions, they know that for training memory, there're also exercises, but intuition is the same. So you have to learn how to trust your intuition. My view is that we similarly undermine the importance of intuition because intuition means taking too much risk. And we, whether we like it or not, we live in a risk adverse culture. And intuitive decision very often cannot be explained into terms that should be required by corporate cullture or by your other family members. So, in my view, by adding this quality of intuition to the decision-making process, we can dramatically improve the results.

"Can intuition be developed?" is half-counter-intuitive, so to say, in the sense that people who have good intuition will say "yes", and people who have a bad intuition will say "no". Still, anyone can observe that a common quality shared by the chess player Bobby Fischer (evoked in the movie Searching for Bobby Fischer), and the poker player Stu Ungar[2] (whose life is narrated in High Roller: The Stu Ungar Story) is that both had a very powerful intuition. Everyone can draw his own conclusions.


[1] The next question in the talk is about the importance of psychology. From Kasparov's answer: "It could actually work in a very strange way when you're facing the computer because many computers, even today, have their own strengths and own weaknesses. And if you can understand so it may help you to design the game which will be the most unpleasant for certain computer. Because it's actually machine, it might sound very odd, but machine definitely has a "personality" and it very much depends on the people behind the computer. So, some of the machines are playing more aggressive chess; some play less aggressive chess. And again, I don't know whether it's an irony or not, but the Israeli-made computers are more aggressive than the German-made computers."

[2] Stu Ungar, jewish, clever, lover of poker, died of a heart failure due to his excesses.

lundi 1 octobre 2012

Casino Royale

Après Las Vegas Parano, voici Casino Royale. Ici, James Bond joue au poker face à trois adversaires, dont son ennemi Le Chiffre.

Petit jeu : examinez la scène et essayez de repérer quelques situations bizarres ("réponses" ci-après).

Lire la suite...

mercredi 19 septembre 2012

Micro-intro au poker

Historiquement un jeu fermé à cinq cartes par personnes, le poker a énormément gagné en popularité avec la création de variantes ouvertes, c'est-à-dire où des cartes sont mises en commun entre les joueurs.

Au Texas hold'em, chaque joueur possède deux cartes et peut miser. Sont ensuite distribuées les cartes en commun : d'abord trois, le flop, puis une quatrième, la turn, et enfin une cinquième, la rivière.

Au Omaha, le système est le même, mis à part que chaque joueur a au début quatre cartes et doit forcément constituer sa main avec deux cartes personnelles et trois cartes du tableau.

Comment apprendre ?

Un bon livre pour l'initiation à la théorie est Play Poker Like The Pros, de Phil Hellmuth, un ancien champion de poker.

Un bon site francophone et gratuit pour la pratique est o-poker, avec beaucoup de choix (cash games, tournois, hold'em, omaha, heads up, speed games, etc).

Life is like a game of cards. The hand that is delt represents your determinisim, the way you play it is free will

Jawaharal Nehru