Rock paper scissors population algorithm, need help!!!

Discussion in 'C++' started by hAmmeRoL@gmail.com, Aug 9, 2007.

  1. Guest

    The problem is described below:

    There are three kinds of units in the map, known as Rock Paper and
    Scissors(randomly generated). Each cell of the map is occupied with
    one of the three units (assume there are no empty cells). Each turn,
    the three units will fight for their terrirory in the map and they can
    only fight in the four directions (up, down, right, left). Rules are
    typical RPS rules. For example, a cell of rock surrounded by four
    scissors will remain rock and the four adjacent cells will be rock in
    the next generation. And a paper cell with at least one adjacent
    scissors cell will be scissors cell in the next generation.

    And now an algorithm is needed to calculate the Nth generation of the
    map.

    My thought now is to check each cell and its adjacent cells. If there
    are at least one cell that can beat this cell, then in the next
    generation the cell will change to that. And we do this method N times
    to calculate the map.
    But I wonder is there some kind of direct approach to this algorithm??
    Or can this algorithm optimize in some way??

    Thanks in advance!
     
    , Aug 9, 2007
    #1
    1. Advertising

  2. wrote:
    > The problem is described below:
    >
    > There are three kinds of units in the map, known as Rock Paper and
    > Scissors(randomly generated). Each cell of the map is occupied with
    > one of the three units (assume there are no empty cells). Each turn,
    > the three units will fight for their terrirory in the map and they can
    > only fight in the four directions (up, down, right, left). Rules are
    > typical RPS rules. For example, a cell of rock surrounded by four
    > scissors will remain rock and the four adjacent cells will be rock in
    > the next generation. And a paper cell with at least one adjacent
    > scissors cell will be scissors cell in the next generation.
    >
    > And now an algorithm is needed to calculate the Nth generation of the
    > map.
    >
    > My thought now is to check each cell and its adjacent cells. If there
    > are at least one cell that can beat this cell, then in the next
    > generation the cell will change to that. And we do this method N times
    > to calculate the map.
    > But I wonder is there some kind of direct approach to this algorithm??
    > Or can this algorithm optimize in some way??


    I don't see a C++ language question here. Could it be you've got
    confused and posted here instead of 'comp.programming'?

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Aug 9, 2007
    #2
    1. Advertising

  3. Guest

    On Aug 9, 8:20 pm, "Victor Bazarov" <> wrote:
    > wrote:
    > > The problem is described below:

    >
    > > There are three kinds of units in the map, known as Rock Paper and
    > > Scissors(randomly generated). Each cell of the map is occupied with
    > > one of the three units (assume there are no empty cells). Each turn,
    > > the three units will fight for their terrirory in the map and they can
    > > only fight in the four directions (up, down, right, left). Rules are
    > > typical RPS rules. For example, a cell of rock surrounded by four
    > > scissors will remain rock and the four adjacent cells will be rock in
    > > the next generation. And a paper cell with at least one adjacent
    > > scissors cell will be scissors cell in the next generation.

    >
    > > And now an algorithm is needed to calculate the Nth generation of the
    > > map.

    >
    > > My thought now is to check each cell and its adjacent cells. If there
    > > are at least one cell that can beat this cell, then in the next
    > > generation the cell will change to that. And we do this method N times
    > > to calculate the map.
    > > But I wonder is there some kind of direct approach to this algorithm??
    > > Or can this algorithm optimize in some way??

    >
    > I don't see a C++ language question here. Could it be you've got
    > confused and posted here instead of 'comp.programming'?
    >
    > V
    > --
    > Please remove capital 'A's when replying by e-mail
    > I do not respond to top-posted replies, please don't ask


    Sorry I got the wrong place, and I have posted another in
    com.programming~
     
    , Aug 9, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TooNaive

    Building Paper, Rock, Scissors

    TooNaive, Jun 14, 2004, in forum: C Programming
    Replies:
    7
    Views:
    548
    T.M. Sommers
    Jun 14, 2004
  2. Ruby Quiz

    [QUIZ] Paper Rock Scissors (#16)

    Ruby Quiz, Jan 21, 2005, in forum: Ruby
    Replies:
    24
    Views:
    317
    Florian Gross
    Jan 25, 2005
  3. Alex Norton
    Replies:
    1
    Views:
    126
    Denis McMahon
    May 13, 2013
  4. Benjamin Kaplan
    Replies:
    0
    Views:
    128
    Benjamin Kaplan
    May 12, 2013
  5. Dave Angel
    Replies:
    0
    Views:
    130
    Dave Angel
    May 13, 2013
Loading...

Share This Page