Java X and O game
Results 1 to 7 of 7

Thread: Java X and O game

  1. #1
    Custom User
    Join Date
    Oct 2001
    Posts
    503

    Java X and O game

    Hey everyone,
    I decided to write a java X and O game and wanted to share it with everyone. I'm sure there are still bugs in it, but someone might find it useful. It is fairly simple, and heavily commented; enabling others to learn from it.

    If you notice any bugs with it please send me a reply to this topic...in fact, send me a reply anyway so that I don't feel like I'm useless and that my program is crap :P.

    Enjoy,

    ac

  2. #2
    Banned
    Join Date
    Mar 2004
    Posts
    28

    Game

    Hey

    at leat you wrote this, even if it's got bugs galore (win 98ish) you stil wrote it, which is more than I can do.

  3. #3
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    The difference between my program and win98 is that my bugs don't cause the computer to crash. But then again, there is a small difference in the size of the two "programs" (win98 is more a collection of programs) and obviously as the code size and complexity increases, the chance of error also increases.

    But apart from that, thanks for the reply...you will probably be the only one who doesn't shun my code.

    [rant] I was under the opinion that this section was for code review. Obviously I don't expect everyone (or anyone) to "review" my code, but I do find it strange that for a section whose sticky topic actually says that it is for the review of code, and not the answering of coding questions, there is fairly little code up for review. [/rant]

    ac

  4. #4
    Banned
    Join Date
    Mar 2004
    Posts
    28

    Kudos

    You still wrote it, which is more than I can do

  5. #5
    Banned
    Join Date
    Aug 2003
    Posts
    130
    Im making a TicTacToe game too. I have the interface done but its the AI im troubled with.

    I'll give you a challenge gothic_type make an AI so the game is one player and we'll review both of our AI's and the construction of our GUI's as mine is different than yours.

  6. #6
    Senior Member
    Join Date
    Jul 2002
    Posts
    339
    You're right mike. I was expecting I'd play against the computer when I downloaded gothic's program. There's no "bugs" in your program, gothic, the interface is simple and easy to understand. But it might be "useless" (no offence) since it has no AI as mike said.

    BTW, there at least two "skill levels" if you want to add AI in the program. Level 1, easier to code, is the defensive one. The program only needs to defend against the player move. Level 2 is more offensive. The program has the ability to attack and fight back.

    Peace always,
    <jdenny>
    Always listen to experts. They\'ll tell you what can\'t be done and why. Then go and do it. -- Robert Heinlein
    I\'m basically a very lazy person who likes to get credit for things other people actually do. -- Linus Torvalds


  7. #7
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    Actually, there are three AI skill levels. There is the defensive mode, and the defensive/offensive mode. But there is also the much easier AI skill level to code. This "special" technique simply involves a call to the Math.random() method. What dyu think?

    Btw -- although you're saying there are no bugs in my code, I was walking down the street the other day, and suddenly I thought about my program. I realised that I had an if statement in the button handler that was completely pointless in the version of code that I uploaded to the site. [ if(game) {... ] In fact, the game var is completely useless, so I took it out.

    Does anyone else find it slightly sad that I walk along the road basically programming? :P lol...amusing.

    Anyhow...if I get a chance, I'll add in some ai code. I'll start just by using a random number generator, then after that, I'll try and add in two other modes. Wow...it'll be my first attempt at any ai.

    Thanks for the posts, though, guys.

    [edit] sorry...didn't notice the "at least" part [/edit]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •