Inteligencia en Redes de Comunicaciones
Robots –
Resolución de Problemas I
Julio Villena Román, Raquel M. Crespo García,
José Jesús García Rueda
{jvillena, rcrespo, rueda}@it.uc3m.es
1
Robots – Resolución de Problemas I
1. Piedra, papel o tijeras
1.1 Introducción
Es un juego infantil originario de Japón. Es un juego de manos en el cual existen tres
elementos. La piedra que vence a las tijeras rompiéndolas; las tijeras que vencen al
papel cortándolo; y el papel que vence a la piedra envolviéndola. Esto representa un
ciclo, el cual le da su esencia al juego. Este juego es muy utilizado para decidir quien
de dos personas hará algo, tal y como a veces se hace usando una moneda, o para
dirimir algún asunto. No es un método de selección verdaderamente aleatorio, puesto
que si el juego se repite durante muchas iteraciones, un buen jugador puede
reconocer y explotar el comportamiento no-aleatorio del oponente.
El nombre del juego puede variar, apareciendo los tres componentes del nombre en
diferente órden. En inglés se llama Rock-Paper-Scissors (a veces se usa “Stone” en
vez de “Rock”) y en francés Pierre-Papier-Ciseaux. En Japón se lo conoce como
jankenpon (じゃんけんぽん), igual que en Brasil: el motivo de que se use la misma
nomenclatura es que los brasileños descendientes de inmigrantes japoneses
acostumbran a jugarlo tal y como se lo enseñaron sus padres: se canta jan... ken... y
se lanza la mano cuando se dice ¡po(n)!. En Perú, por adaptación fonética, se llama
ca-chi-pún.
De la World RPS Society:
Contrary to what you might think RPS is not simply a game of luck or chance.
While it is true that from a mathematical perspective the „optimum‟ strategy is
to play randomly, it still is not a winning strategy for two reasons.
First, „optimum‟ in this case means you should win, lose and draw an equal
number of times (hardly a winning strategy over the long term). Second,
Humans, try as they might, are terrible at trying to be random, in fact often
humans in trying to approximate randomness become quite predictable. So
knowing that there is always something motivating your opponent‟s actions,
there are a couple of tricks and techniques that you can use to tip the balance
in your favour.
1.2 Cómo se juega
[Copiado de http://es.wikipedia.org/wiki/Piedra-Papel-Tijera]
Los jugadores cuentan juntos "1 ... 2 ... 3 ... ¡Piedra, papel o tijera!"/"¡Jan ken
pon!"/"¡Ca chi pun!" y justo al acabar muestran todos al mismo tiempo una de sus
manos, de modo que puede verse el arma que cada uno ha elegido:
Piedra: un puño cerrado.
Papel: todos los dedos extendidos, con la palma de la mano mirando hacia
abajo, arriba o de lado.
Tijeras: dedos índice y corazón extendidos y separados formando una "V".
2
El objetivo es vencer al oponente seleccionando el arma que gana a la que ha elegido
él, siguiendo estas reglas:
1. La piedra aplasta o rompe las tijeras (gana la piedra)
2. Las tijeras cortan el papel (ganan las tijeras)
3. El papel envuelve la piedra (gana el papel)
4. Si los jugadores eligen la misma arma es un empate y
se juega otra vez
Típicamente, cada una de estas pequeñas partidas se repite hasta que uno de los
jugadores gana dos veces de tres o tres de cinco, siendo entonces el vencedor del
juego.
1.3 Estrategia
[Copiado de http://es.wikipedia.org/wiki/Piedra-Papel-Tijera]
La estrategia entre jugadores humanos incluye, obviamente, el uso de la psicología
para tratar de predecir o influenciar el comportamiento del adversario. Se considera
aceptable el uso del habla con la intención de despistar o engañar ("¡Nada le gana a
una buena piedra!") o también como vemos en Los Simpson: Lisa a sí misma- Pobre
Bart siempre elige la piedra. Bart a sí mismo- La piedra es la mejor... nada le gana.
Matemáticamente, la forma óptima de jugar (de acuerdo con la teoría de juegos) se
reduce a un problema de elección aleatoria y, por tanto, el juego puede considerarse
trivial en ese sentido, si se juega eliminando la psicología, como un ordenador. Pero
"óptimo" en ese sentido significa sólo "imposible de ser derrotado más de lo que se
puede esperar estadísticamente", lo cual no implica que la estrategia aleatoria sea la
mejor para conseguir ventaja de frente a un contrincante subóptimo. De hecho, si el
oponente es humano o un programa no aleatorio, es casi seguro que juegue de forma
subóptima y un estrategia modificada adecuadamente puede explotar esta debilidad.
Está demostrado por Roshambot, un programa que gana fácilmente a algunos
jugadores humanos (como hace su autor Perry Friedman, que ganó una competición
de 800$ contra siete oponentes incluyendo al ex campeón mundial de póker Phil
Hellmuth en agosto de 2001). El jugador de póker Darse Billings de la Universidad de
Alberta organizó una competición de Piedra-Papel-Tijera para estudiar estas
posibilidades y su aplicación a otros juegos de ordenador (especialmente el póker, en
el cual una parte importante de la estrategia es explotar el comportamiento no
aleatorio de los jugadores).
En 2005 podemos encontrar una buena opinión estratégica de las hermanas mellizas
Alice y Fiora Maclean, de 11 años de edad, cuando las casas de subastas rivales
Christie's y Sotheby's estuvieron de acuerdo en jugar a piedra-papel-tijera para
determinar los derechos de una colección de arte altamente valorada. Nicholas, padre
de las hermanas Maclean y director internacional del departamento de Impresionismo
y Arte Moderno de Christie‟s, le pidió consejo a las niñas. Ellas jugaban al “piedra,
papel o tijera” en la escuela “casi todos los días”, aclaró la pequeña Alice, y su
estrategia se resumía así: “Todo el mundo sabe que siempre se empieza con tijeras. La
piedra es un modo demasiado obvio, y las tijeras ganan al papel.” A esto, Fiora dijo
que "desde novatas, siempre supimos que las ´tijeras´ eran lo más seguro”. Señaló,
además, que si la otra parte también elije ´tijera´ y se requiere otra ronda, el juego
3
correcto sería volver a elegir ´tijera´, pues el otro suele pensar que optarás por la
´piedra´". (Finalmente Christie‟s ganó, con tijeras).
1.4 ¿Cómo ganar?
[Copiado de http://www.mentalfloss.com/blogs/archives/2032]
The top secrets to winning at RPS — courtesy of Graham Walker, Director of
Management of the World RPS Society — are after the jump.
1 - Rock is for Rookies
In RPS circles a common mantra is “Rock is for Rookies” because males have a
tendency to lead with Rock on their opening throw. It has a lot to do with idea that
Rock is perceived as “strong” and forceful”, so guys tend to fall back on it. Use this
knowledge to take an easy first win by playing Paper. This tactic is best done in
pedestrian matches against someone who doesn‟t play that much and generally won‟t
work in tournament play.
2 - Scissors on First
The second step in the „Rock is for Rookies‟ line of thinking is to play scissors as your
opening move against a more experienced player. Since you know they won‟t come out
with rock (since it is too obvious), scissors is your obvious safe move to win against
paper or stalemate to itself.
3 - The Double Run
When playing with someone who is not experienced at the RPS, look out for double
runs or in other words, the same throw twice. When this happens you can safely
eliminate that throw and guarantee yourself at worst a stalemate in the next game. So,
when you see a two-Scissor run, you know their next move will be Rock or Paper, so
Paper is your best move. Why does this work? People hate being predictable and the
perceived hallmark of predictability is to come out with the same throw three times in
row.
4 - Telegraph Your Throw
Tell your opponent what you are going to throw and then actually throw what you
said. Why? As long as you are not playing someone who actually thinks you are bold
enough to telegraph your throw and then actually deliver it, you can eliminate the
throw that beats the throw you are telegraphing. So, if you announce rock, your
opponent won‟t play paper which means coming out with that scissors will give you at
worst a stalemate and at best the win.
5 - Step Ahead Thinking
Don‟t know what to do for your next throw? Try playing the throw that would have lost
to your opponents last throw? Sounds weird but it works more often than not, why?
Inexperienced (or flustered) players will often subconsciously deliver the throw that
beat their last one. Therefore, if your opponent played paper, they will very often play
Scissors, so you go Rock. This is a good tactic in a stalemate situation or when your
opponent lost their last game. It is not as successful after a player has won the last
game as they are generally in a more confident state of mind which causes them to be
more active in choosing their next throw.
6 - Suggest A Throw
4
When playing against someone who asks you to remind them about the rules, take the
opportunity to subtly “suggest a throw” as you explain to them by physically showing
them the throw you want them to play. ie “Paper beats Rock, Rock beats scissors
(show scissors), Scissors (show scissors again) beats paper.” Believe it or not, when
people are not paying attention their subconscious mind will often accept your
“suggestion”. A very similar technique is used by magicians to get someone to take a
specific card from the deck.
7 - When All Else Fails Go With Paper
Haven‟t a clue what to throw next? Then go with Paper. Why? Statistically, in
competition play, it has been observed that scissors is thrown the least often.
Specifically, it gets delivered 29.6% of the time, so it slightly under-indexes against the
expected average of 33.33% by 3.73%. Obviously, knowing this only gives you a slight
advantage, but in a situation where you just don‟t know what to do, even a slight edge
is better than none at all.
8 - The Rounder’s Ploy
This technique falls into more of a „cheating‟ category, but if you have no honour and
can live with yourself the next day, you can use it to get an edge. The way it works is
when you suggest a game with someone, make no mention of the number of rounds
you are going to play. Play the first match and if you win, take it is as a win. If you
lose, without missing a beat start playing the „next‟ round on the assumption that it
was a best 2 out of 3. No doubt you will hear protests from your opponent but stay
firm and remind them that „no one plays best of one for a kind of decision that you two
are making‟. No this devious technique won‟t guarantee you the win, but it will give
you a chance to battle back to even and start again.
1.5 Competición
El objetivo es construir un robot Lego capaz de jugar autónomamente al juego de
Piedra-Papel-Tijeras contra un humano.
Por ejemplo, el robot puede usar 3 lámparas para señalar las tres jugadas posibles y
leerá la jugada del oponente mediante 3 sensores.
Un cuarto de hora antes del final de la clase, se establecerá una jugada fija de 9
tiradas y con ella realizará una evaluación de cada robot. Ganará el jugador que
consiga 5 puntos.
Para ser válido, el robot debe ser capaz de emitir su jugada y leer la del oponente,
determinando quién gana la ronda y la partida completa. Lógicamente los robots
deben emitir su jugada antes de leer la del contrario; se examinará el código de los
robots para detectar si hay trampas.
5
2. El dilema del prisionero
El objetivo de los equipos es construir y programar un robot que sea capaz de jugar
contra un humano al juego del Dilema del Prisionero en su modalidad iterada.
[Wikipedia: http://es.wikipedia.org/wiki/Dilema_del_prisionero]
Se realizará una competición de 9 rondas para determinar al ganador, según un
esquema similar a http://www.gametheory.net/Web/PDilemma/.
3. Catapulta
El objetivo de los equipos es construir y programar una catapulta que sea capaz de
lanzar objetos (bolas de papel) apuntando a una zona objetivo.
El robot, tras cada lanzamiento, leerá por medio de sensores o de los botones del
brick, cómo ha ido el tiro. Por ejemplo, con tres botones se podría indicar: largo, corto,
blanco; con cinco botones: muy largo, largo, blanco, corto, muy corto.
Una posible estrategia es aplicar hill-climbing o su variación simulated annealing.