Game algorithm/wining AI

Discussion in 'Programmer's Corner' started by ecjohnny, Feb 8, 2012.

  1. ecjohnny

    Thread Starter Senior Member

    Jul 16, 2005
    142
    0
    Hey i am currently introduced to simple game programming. I need to code an AI in C++ that will win my friend AI.

    The game is like a round-based game. A move is made every round. To be more specific its a simplify version of a Pokemon but with limited function. For those who don't know what a Pokemon game is, think of it like a Rock.scissors,paper game. In pokemon is fire win grass win water win fire. Every round a decision is made by opp AI and Player AI.

    I am not asking for help in coding but rather if there is an algorithm/method of program such that your AI WILL win everytime. I have been thinking for very long time for a method/alg but since your opp AI issnt known to u, it is very hard and somehow i think its based on luck. The basic winning strategy is to switch to a stronger one but there is a limited switch of 3. Which means whoever switches first will lost. because your opp will switch to a stronger one and you will switch to counter as follows. Of course, there are function like defense,attack,element attack..etc just like in round-based game.

    I hope this is not confusing and the above just mean a sure-win AI in round-based game. I will clarify further if needed.

    Thanks.
     
  2. Maccara

    New Member

    Aug 22, 2009
    8
    0
    You can't guarantee win against all opponents unless game rules allow for such a strategy (similarly as like tic-tac-toe where if players play perfect game it's always a draw).

    Simple games (like tic-tac-toe with only few different positions) you could analyze completely to find if there is a simple winning strategy. Complex games require much more than that.

    For example, chess is turn based, too big to analyze completely, and there's no guarantee 1 AI will always win another.

    Rock-paper-scissors: Easy to see there's no strategy giving advantage over properly randomized opponent.
     
Loading...