Problem 650. Steal, Share, or Catch

You, I, and a few other characters are going to play a game of Steal, Share or Catch. We are going to play it 10,000 times vs. each of the characters.

The rules of the game are this:

  • There are two points available each round
  • We will both choose to either Steal, Share, or Catch
  • If we both choose Share, we both get one point.
  • If one chooses Steal and the other Share, the Stealer gets two points.
  • If one chooses Steal and the other Catch, the Catcher gets two points.
  • Any other combination, no one is awarded points.

You are to write an algorithm that will return either

  • -1: Steal
  • 0: Share
  • 1: Catch

To help you make your choice, you will have a history vector that shows what your choices have been so far, and what the opponent's choices have been. These histories are in the form of:

[-1
  1
  1
  0]

Meaning that the first round there was a Steal, then two Catches, then a share.

The characters you will play against are:

  • Evil (always steals)
  • Good (always shares)
  • Chaos (randomly chooses)
  • Doug (Something more complicated)

As this problem runs, I will take the better entries and add them into the cast of characters that you play against. Maybe in a different Cody problem though.

The scores to beat are:

terribleScore   =     0; % works
badScore        = 23000; % good  strategy scores this
okScore         = 26000; % evil  strategy scores this
decentScore     = 29000; % chaos strategy scores this
greatScore      = 42000; % doug  strategy scores this

If you can make a winning solution here, it might be added to the Tournament of Champions version of this problem. E-mail me if you want yours added.

Solution Stats

32.44% Correct | 67.56% Incorrect
Last Solution submitted on Jan 15, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers78

Suggested Problems

More from this Author51

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!