Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks, I need a strategy to biuld this please help mee out i hav this project to be complted but i am unable to find out a good strategy got soem ideas but they r really not applicable over here ...........

I need your help i need soem good solution strategies Here is wat i need a breif explaination


Nash equilibrium is defined as an outcome with the following property: each player's strategy is the best response against the other player's strategy. In other words, Nash equilibrium consists of two actions that are best responses against each other.

If players' actions are best responses against each other, then neither player will be willing to switch to another action given that his opponent sticks to the equilibrium action. In other words, a player cannot do better by changing his mind, given that his opponent doesn't change his mind. Why? Because if a player changes his mind and switches to another action, this action will be inferior (remember that the equilibrium action is the BEST response against the opponent's action). As a result, the player will be worse off! In a sense, every Nash equilibrium defines a saddle point from which nobody wants to deviate.


Do not confuse a strategy with an action. In most of your games, there are only two available actions. On the other hand, a strategy is a complete algorithm for playing the game that specifies which action the player must take at every step of the game (since the game is played 1000 times between two strategies, there are 1000 such steps). Therefore, you need to implement three different algorithms and play them against each other in a round-robin tournament.


It does not require that you choose perfect strategies. However, I will give you bonus points if your strategies are good, i.e., they can defeat most other strategies. An example of a weak strategy is a strategy that always plays the same move (1000 times) regardless of the opponent's behavior.


A good strategy must take into account the history of all previous moves played by the player and his opponent and define the player's next move. The main problem in defining the next move is that the strategy doesn't know how the opponent is going to play (please, keep in mind that the players make their moves simultaneously without knowing what the other player is going to do). A "smart" strategy would try to predict the opponent's next move based on the history of his previous moves. Since every game is played 1000 times in a row, the strategy can collect information about the opponent's past moves, opponent's reactions to specific moves (or to specific move sequences) and came up with a reasonable guess about the opponent's next move. As you can see, a good strategy would try to learn from the previous moves and adjust its behavior appropriately in order to defeat the opponent.

The bottom line is that a good strategy must be dynamic. It would take into account the opponent's previous moves and adjust its behavior appropriately. In other words, it will dynamically change its behavior as a response to the opponent's past behavior.


The simplest dynamic strategy is a random strategy. However, it is not a very smart choice because it does not learn from the opponent's past moves. After you come up with some good strategies, you could test them against a random strategy to see how good they are. In fact, playing against a random strategy is not as easy as it could seem (because one cannot come up with any rational expectations. If your opponent plays randomly, then everything is possible).

There is no problem if one of your strategies is purely random.


- Three different strategies, i.e., three methods that can play a round of 1000 games in a row against the same opponent. In every single game (there are 1000 such games in a round), the output of your method must be an action. Usually there are two available actions, and your method (strategy) must decide which action to play.

- A main program that can play a round-robin tournament between the three strategies (methods). When the main program plays two strategies against each other, it enters a loop (of 1000 repetitions) in every step of which it receives the outputs from the strategies, determines the outcome, and sends each strategy its score and the opponent's move (remember that when a strategy decides which action to play, it doesn't know how the opponent is going to play). After all three strategies are played against one another, the main program reports the final result from the tournament.

Please provide me a better strategy or any good idea for this and help me out monks....

Work Hard Party Harderrr!!
Sushil Kumar

In reply to Need a Strategy to work out by msk_0984

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (7)
    As of 2018-11-15 10:06 GMT
    Find Nodes?
      Voting Booth?
      My code is most likely broken because:

      Results (182 votes). Check out past polls.

      • (Sep 10, 2018 at 18:53 UTC) Welcome new users!