Rock, Paper, Scissors type game. AI?

ShaneS429ShaneS429 Member Posts: 77
edited November -1 in Working with GS (Mac)
I finally jumped into getting a Mac and am using GS for my first game I am building with a friend. We have 3-4 ideas fully written out and we plan on doing all of them but we figured we'd start with a simpler idea.

Without giving our game away, the basic idea behind our game takes a spin on rock paper scissors but not just 1 on 1. Right now we are only doing Player vs AI gameplay.

I am quickly learning gamesalad and have actually gotten through a lot of the building process in a few days.

What is troubling me is AI computer opponents. Because this is a rock, paper, scissors type game, each move can be beat by another move. How would I make a form of AI that could weigh the options? Should I even have complex AI? Since everything can be beaten by another thing, is a simple random choice for the AI going to be good enough?

I can't help but think in real rock, paper, scissors, most of the time people just randomly pick a move knowing that they can only beat one thing and get beaten by one thing. Maybe a random number generator of 1-3 for the AI is enough?

Any insight would be great!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Well since Rock Paper scissors is a random 1-3 number. Not sure what other complexity you would want. If you are basing the AI selection based on the user input then your game would be rigged. I guess maybe i'm missing the bigger question or maybe you are not actually asking the bigger question so its a bit unclear.
  • ShaneS429ShaneS429 Member Posts: 77
    tenrdrmer said:
    Well since Rock Paper scissors is a random 1-3 number. Not sure what other complexity you would want. If you are basing the AI selection based on the user input then your game would be rigged. I guess maybe i'm missing the bigger question or maybe you are not actually asking the bigger question so its a bit unclear.

    You got my question. I just wasn't sure if making a game where the computer has a completely random choice would end up being easy at any given point.

    I guess when I think about it, if the computer's choice is always random, the user can't ever predict what they are going to do, and thus can't ever guarantee that their choice will be the right one.

    I have no intention of having the player make a choice then having the AI read that choice and act accordingly. Where is the fun in that?
  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,194
    For Ninja RPS, we came up with "strategies" that were basically computer cheats in different but predictable ways. (Always plays rock, tries to copy you, etc).

    But yes, there's not really much AI to RPS. Maybe a system where you record previous moves and change the weighting of the randomness? (e.g. the more someone use a given move, the more likely it will happen next time, etc).

    R (count)
    P (count)
    S (count)

    Rp = 1 - (P+S) / (R+P+S) * 100
    Pp = 1 - (S+R) / (R+P+S) * 100
    Sp = 1 - (R+P) / (R+P+S) * 100

    m = rand(1,100)

    if (m < Rp) choose rock
    if (m > Rp && m <= (Rp+Pp)) choose paper
    if (m > (Rp + Pp) && m <= (Pp+Sp)) choose scissors

    Or something like that.
  • ShaneS429ShaneS429 Member Posts: 77
    adent42 said:
    For Ninja RPS, we came up with "strategies" that were basically computer cheats in different but predictable ways. (Always plays rock, tries to copy you, etc).

    But yes, there's not really much AI to RPS. Maybe a system where you record previous moves and change the weighting of the randomness? (e.g. the more someone use a given move, the more likely it will happen next time, etc).

    R (count)
    P (count)
    S (count)

    Rp = 1 - (P+S) / (R+P+S) * 100
    Pp = 1 - (S+R) / (R+P+S) * 100
    Sp = 1 - (R+P) / (R+P+S) * 100

    m = rand(1,100)

    if (m < Rp) choose rock
    if (m > Rp && m <= (Rp+Pp)) choose paper
    if (m > (Rp + Pp) && m <= (Pp+Sp)) choose scissors

    Or something like that.

    Thanks for the input. I'm not sure how well that would work in my game however. Again, without giving my idea away, lets just say you don't win/lose with one turn and just because two people chose "scissors" won't mean it will end in a tie.

    I guess a completely random AI wont exactly be easy nor hard. The Player might end up being their worst enemy in my game.
Sign In or Register to comment.