Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

[ Game ] Four In A Row - Ai Game!

Discussion in 'Your Work' started by Lotem, May 10, 2017.

Thread Status:
Not open for further replies.
  1. Lotem

    Lotem Ex-Moral supporter in the official Wynncraft CT™ HERO

    Messages:
    805
    Likes Received:
    3,829
    Trophy Points:
    159
    Guild:
    Minecraft:

    [​IMG]
    (The logo is taken from google and wasn't made by me)

    Yo guys, Lotem is here!
    This time I'd like to share with you a small game I programmed by myself :D

    Some Background
    I always thought AI (Artificial Inelegance) is a super interesting subject.
    Most of you probably remember the AI puzzle from ???, where you have to win the computer in some kind of a sliding game. That was my very first AI (And it was 100% vanilla minecraft and command blocks!).
    Since then, I kept creating few different AIs, inside and outside of minecraft, and I learned more algorithms.

    The Game
    Two days ago I started to code another AI game (in Java), and this time I wanted to share it with you. The game is called "Four In A Row" (or "Connect Four"), and it's a game I personally really enjoy playing with my friends. This game requires lot of thinking and planning ahead your moves.
    For more information about the game you can read its wiki page.

    The AI isn't perfect - you can win sometimes if you play smart. But for me it's still very cool to see how my basic maths created such a good AI.
    (For those who're interested, the AI is based on the Minimax algorithm with Alpha–beta pruning)

    Download
    Download Link - 14 KB (Google Drive)
    * The download is 100% safe, and the game doesn't requires any installations. You just download it and double click the file to play.

    I might keep updating the game and post better versions later.

    Changelog
    • Improved graphics (bigger lines, different color for the last placed shape)
    • Improved the complexity of code, the AI should work slightly faster
    • Improved rules and information window
    • When someone wins the four shapes in row are now highlighted
    • You can now press S to stop the game and restart

    If you manage to win a game against the AI, make sure to take a picture and post it here to get some fame!

    Good luck and have fun!
     
    Last edited: May 10, 2017
    Coolfood, Dohdo, Malkavian and 16 others like this.
  2. Snipah

    Snipah Valar Morghulis HERO

    Messages:
    0
    Likes Received:
    492
    Trophy Points:
    69
    Minecraft:
    Took a few goes, but I did 7x6 in 37 turns! Still trying to beat the default 7x7, that Ai is damn smart

    [​IMG]
     
    Lotem likes this.
  3. moosea1

    moosea1 Well-Known Adventurer

    Messages:
    93
    Likes Received:
    75
    Trophy Points:
    49
    Minecraft:
    Got the default 7x7 in 40 turns. Only took me 1o minutes.
    Proof
    Screenshot (26).png
     
    Lotem likes this.
  4. Lotem

    Lotem Ex-Moral supporter in the official Wynncraft CT™ HERO

    Messages:
    805
    Likes Received:
    3,829
    Trophy Points:
    159
    Guild:
    Minecraft:
    So you should try to win in a 10 by 10 board :)
     
  5. Yuno F Gasai

    Yuno F Gasai Forum God, FW

    Messages:
    13,418
    Likes Received:
    28,688
    Trophy Points:
    229
    Guild:
    Minecraft:
    I'm dumber than your ai ;-;
     
    Malkavian, Dohdo and Lotem like this.
  6. moosea1

    moosea1 Well-Known Adventurer

    Messages:
    93
    Likes Received:
    75
    Trophy Points:
    49
    Minecraft:
    Finally got the 8x8... wow that took a while.
    Screenshot (27).png
     
    Lotem likes this.
  7. Lexwomy

    Lexwomy Lexwomy HERO

    Messages:
    3,164
    Likes Received:
    1,390
    Trophy Points:
    125
    Minecraft:
    yey, 7x6 in 39 turns [​IMG]
     
    Lotem likes this.
  8. Dohdo

    Dohdo I'm back. Cancer in it's purest form.

    Messages:
    3,276
    Likes Received:
    2,200
    Trophy Points:
    125
    Guild:
    Minecraft:
    I decompiled it and looked at the PlayerAI and... I've never seen more interesting code. Props to you
     
    Lotem likes this.
  9. Lotem

    Lotem Ex-Moral supporter in the official Wynncraft CT™ HERO

    Messages:
    805
    Likes Received:
    3,829
    Trophy Points:
    159
    Guild:
    Minecraft:
    Thanks :)
    I can share the source code if anyone would like me to.
     
    Dohdo likes this.
Thread Status:
Not open for further replies.