(Note: This is simply a programming exercise I created for myself. All information theory concepts are taken from the literature. No new contributions are made here by me. -- Howard :)
(Note: Code intended to run under Python 2.7. I will re-write for Python 3.6 at a later date. -- Howard :)
Welcome to Data Negotiation World
Imagine you are in a world where everything functions by way of
communication or negotiation between two parties -- we can call
them Bob and Alice. Even machines are built in this fashion --
there is a communication back and forth between the user and the
machine, in a Bob -- Alice fashion. Everything in this world --
people, the rules of society, machines, even many biological mechanisms
function like this.
The problem is that neither 'Bob' nor 'Alice' have infinite memories
or infinite time to assist with the communication they must produce
in reponse to a communication and usually many previous communications
they have received.
Let's explore the properties of this 'Data Negotiation World' with a
game of space complexity. Bob and Alice can use different strategies,
including the mirror strategy discussed in the comments of this code,
and have access to different amounts of computional cycles ('time
complexity') and different amounts of memory space ('space
complexity').
In this game of space complexity, Alice and Bob will take turns
saying a number (positive integers are used).
If one of the players says a number which has already been said,
then that player loses.
Your role is as referee, setting the rules (ie, algorithms and
parameters) which Alice and Bob can use.
Note: Alice always moves first.
Note: Default mode is that no ties are allowed -- if any player
makes a wrong guess for any reason, including all the numbers
being used up, then that player loses. However, user configurable so
that ties can be allowed to occur if all numbers used up and no
player has lost yet.