A Guessing Game

The online contest A Guessing Game takes place between May 11 and June 1, 2020.
The competitors will create a computer program that is good at the game “A Guessing Game” (Odd-and-Even or Matching Pennies).
Here you can find details about registration, competition platform, rules.

All you know about luck for certain is that it’s bound to change.” – Bret Harte, “The Outcasts of Poker Flat” in The Luck of Roaring Camp and Other Stories

https://www.targulcartii.ro/bret-harte/surghiunitii-din-poker-flat-pentru-literatura-universala-1965-301049

The goal of the game A Guessing Game (Odd-and-Even or Matching Pennies) is to guess what your opponent will play. It is useful to accept that we (each of us when we play on a server with the proposed version but also the program we designed to play) are player j1 and our opponent is player j2, against we are compete.

According with the style of playing of  the matching pennies game, each player chooses one side of the coin: H=Head or T=Tail. If two players have chosen the same side, the first player wins one round. Otherwise, if the faces are different, he loses and the second player have win. We define a binary variable w(win) that takes the value 1 if j1 won, and the value 0 if j2 is the one who won.

After the first round follows another one and so on until the game ends (after N rounds where N is determined from the beginning). After the first round, depending on what happened or after the previously settled plan, we choose again whether to play H or T. More specifically, in the sense described by Edgar Allan Poe in his short story The Purloined Letter) (Scrisoarea furată )  where there is a little boy which always wins the game  Odd or Even, by analyzing if the opponent chooses to change or play like last time, we choose if we play the same (binary variable c= change takes the value 0) or change previous option (c takes value 1).

Gradually, or “step by step” we can build a game history. Suppose we reach round t and we should choose what to play.

ai is the choice of player j1 (us) in round i, ai ∈ {H, T}.

bi ∈ {H, T} is the choice of player  j2 (the adversary) in round i.

The variable c of change is defined only for what we play and therefore:

For example, suppose a game evolved according to the following table and we reached round 15:

The score is the total gain, namely the difference between the total number of won rounds and total lost rounds; in this example it is -1 (minus one).

It is noted that any time (in any round) immediately after we set the change or not, the choice is already made because the opponent’s choice is synchronous with ours and therefore the victory w is determined. However, we make our decision for the next round, after learning the result of the previous round (obviously there may be players who play according to the plan previously settled which does not depend on the opponent’s choice or the result from previous rounds, but I think a rational attitude is required and therefore I do not intend to set the program to do so).

That’s why I want to point out that the decision to change the value of ci is after finding out the result of the previous round and I prefer to view my previous table under the form:

p>

In conclusion, the history of the game is made of a binary string

{a0,b0,a1,b1,…,ai,bi,…,at-1,bt-1} or the equivalent binary string

{w0,c1,w1,…,ci,wi,…,ct-1,wt-1}, but must be initialized with the initial condition a0. I prefer this variant and it corresponds to a binary string consisting of symbols x i∈ {1,0}, in the binary alphabet Σ = {1,0}. The previous version of history was also a binary string, but in the alphabet Σ = {H, T}, that does not emphasize the decision to change. Because we are here, we can save the history as a string of pairs (ai , bi ), and the string elements will belong to an alphabet with four symbols.

In order to have experimental dates which will train the models, I suggest you go online using link below, set up an account using a valid email address and choose to play a game of 200 rounds. Play serious, try to guess what the program opponent will play and defeat him.

http://193.226.29.27/GuessingGame