Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Programming AI for simple game?

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Programming AI for simple game?

    thanks for ze help
    Last edited by YouGoLast; May 30th, 2011 at 03:54 AM.


  2. #2
    Member
    Join Date
    Jan 2011
    Posts
    78
    My Mood
    Confused
    Thanks
    23
    Thanked 1 Time in 1 Post

    Default Re: Programming AI for simple game?

    Sounds like you just need to come up with some good algorithms based on math that determine how many they want to take from the pile. Obviously they don't want to take the last one if it can be helped. I think a lot of if statements would be the way to go. if (2 stones in pile 3 remain && pile 1 && pile 2 are empty) take 1 etc. =/ it doesn't really seem to be that much of a strategic game so I don't know how much you could really do.

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Programming AI for simple game?

    I think understanding the math behind the game will definitely help you create an AI which will always win (if it can). This game is also known as Nim.

    For a mathematical approach to always winning, see Nim - Wikipedia

Similar Threads

  1. Simple Checkers Game in J2ME
    By chris2307 in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: February 26th, 2011, 06:40 AM
  2. simple game with swing and awt problem
    By Pulse_Irl in forum AWT / Java Swing
    Replies: 2
    Last Post: October 12th, 2010, 02:04 PM
  3. Simple game in Java
    By velop in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 27th, 2010, 05:04 AM
  4. Robo Code - The funny Java Programming Game
    By Freaky Chris in forum The Cafe
    Replies: 20
    Last Post: October 8th, 2009, 03:42 PM
  5. Problem while programming a simple game of Car moving on a road
    By rojroj in forum Java Theory & Questions
    Replies: 3
    Last Post: April 2nd, 2009, 10:24 AM