Hi everyone. I wrote a Rock Paper Scissors program my first quarter of C++ two years ago, and now I have a job at a programming job. I showed someone my little easy program and they challenged me to make a verson 2.0 with AI and a gui. The Gui Ican create fine. The AI is what I need help with. I've only messed with AI once and it was mostly written for us in class. I guess what I am asking is a starting point? I have a copy of the program I do not wish to place on here, so other people won't use it in school, if needed.

Hi everyone. I wrote a Rock Paper Scissors program my first quarter of C++ two years ago, and now I have a job at a programming job. I showed someone my little easy program and they challenged me to make a verson 2.0 with AI and a gui. The Gui Ican create fine. The AI is what I need help with. I've only messed with AI once and it was mostly written for us in class. I guess what I am asking is a starting point? I have a copy of the program I do not wish to place on here, so other people won't use it in school, if needed.

Rock Paper Scissors doesn't seem like a good program for an AI to me. There's not much strategy to it. The only thing I can think of is that you could keep track of all the prior moves and if the human player displays any kind of pattern (i.e. always chooses rock, always chooses scissors if he/she won with scissors the last time, etc.), exploit that pattern. As Rock Paper Scissors is a "one-move-game", there's no way to analyze the board and make decisions based on the board, like there is in Connect 4, Tic Tac Toe, and games like that.

I guess it is quite simple,

You can use an array for rock paper and scissors,
Then try to generate a random number,

After a random number is got, you can use the modulo operator to get the remainder after dividing by 3,

So then you get the computers choice,

Then i guess you can write out how the game works,

rock beats scissors,
scissors beats paper
paper beats rock ; :)

Hope this helps.

So I guess with Rock Paper Scissors, The only AI that is really possible is preventing series of moves that have already been played. And maybe counting the number of times an order as been used to predict which order to use in duplicate orders? You think I am on the right track with that?

Also,

As Rock Paper Scissors is a "one-move-game", there's no way to analyze the board and make decisions based on the board, like there is in Connect 4, Tic Tac Toe, and games like that.

The assignment I had with AI was for the board game I wrote called Othello. (Often called Reversi).

So I guess with Rock Paper Scissors, The only AI that is really possible is preventing series of moves that have already been played. And maybe counting the number of times an order as been used to predict which order to use in duplicate orders? You think I am on the right track with that?

Also,

The assignment I had with AI was for the board game I wrote called Othello. (Often called Reversi).

Othello is a much better game for AI. You can analyze the board and think of a move based on the board. There are states in the game that can be analyzed and acted upon. Rock, Paper, Scissors is a game with no strategy other than a psychological strategy. You are trying to predict another person's move based on personality/prior behavior. Psychology is not an easy thing to program. Unlike Othello, where you can mathematically analyze a CURRENT game, the only thing you can do with Rock-Paper-Scissors is analyze PAST games. So there is absolutely no way to develop an AI for a single Rock Paper Scissors game, unlike Othello. If you want to do AI, you are working in the realm of statistics of past games, similar to the Prisoner's Dilemma game and the "Tit for Tat" strategy. So you can, if you want, keep track of a whole bunch of games by a single player and see if any kind of pattern develops, using statistical calculations. Me, I'd rather do a more traditional AI project with a game like Othello, Tic Tac Toe, Checkers, etc.

The only AI that is really possible is preventing series of moves that have already been played.

You can't prevent or respond to an opponent's move. This isn't Tic Tac Toe where moves can be prevented. Both players move simultaneously in Rock Paper Scissors. All you can do is try to predict in advance what the move will be and pick the move that beats it.

prevent was supposed to be predict*. Thanks for your help VernonDozier

This article has been dead for over six months. Start a new discussion instead.