[Add-on] Tic-Tac-Toe NPC. Moogra is mean.

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Okay so, I made a bet with Moogra meanwhile playing Minesweeper. I lost with a score of 25 - 26. Which is sad because he just cheated somehow. :(

    Anyhow, making up my word as a loser. I had to release anything to RaGEZONE. He knows I hate to release, so he is probably with a huge smiley in his face while eating tacos. (Yes, Moogra is Mexican).

    Okay, so, on topic. This is the NPC I made for my lose :(.

    Don't enjoy it.

    PHP Code:
    status = -1;
    playerFlag 0;
    computerFlag 0;
    var 
    playerColor;
    var 
    computerColor;

    function 
    start() {
        
    cm.sendYesNo("Hello #h #. I just lost a bet against Moogra. He punished me hard, so meanwhile my injuries are not yet sanitized... Wanna play tic tac toe with a brainless computer and gain a #b#t1002140##k?");
    }

    function 
    action (modetypeselection) {
        if (
    mode != 1) {
            if (
    type == && mode == 0) {
                
    cm.sendNext("Coward.");
            }
            
    cm.dispose();
            return;
        }
        
    status++;
        if (
    status == 0) {
            
    cm.sendSimple("What do you wants be?\r\n\r\n#b#L0#First player.\r\n#L1#Second player.");
        } else if (
    status == 1) {
            
    playerColor selection == 3991040 3991049;
            
    computerColor selection == 3991023 3991014;
            if (
    selection == 1) {
                
    computerMoves();
            }
            
    play();
        } else {
            if ((
    playerFlag & (<< selection)) == (<< selection) || (computerFlag & (<< selection)) == (<< selection) || selection || selection 9) {
                
    cm.sendNext("No cheaters allowed.");
                
    cm.dispose();
                return;
            }
            
    playerFlag |= << selection;
            if (((
    playerFlag computerFlag) ^ 511) == 0) {
                
    tie();
                return;
            }
            for (var 
    03; ) {
                if (
    isWinner(playerFlagi++)) {
                    
    win();
                    return;
                }
            }
            
    computerMoves();
            for (var 
    03; ) {
                if (
    isWinner(computerFlagi++)) {
                    
    lose();
                    return;
                }
            }
            
    play();
        }
    }

    function 
    play() {
        
    cm.sendSimple(loadText(true));
    }

    function 
    win() {
        if (
    cm.canHold(1002140)) {
            
    cm.gainItem(10021401);
            
    cm.sendNext(loadText(false) + "\r\n\r\nWoah! You made it! Congratulations! You have won a #b#t1002140##k.");
        } else {
            
    cm.sendNext("Woah! You made it! Congratulations! But I'm sorry to tell you that I can give you the #b#t1002140##k because your Equip inventory seems to be full. Try again later.");
        }
        
    cm.dispose();
    }

    function 
    isWinner(playerval) {
        return (
    player & (<< (val 3))) == << (val 3) || (player & (73 << val)) == (73 << val) || (((player & (<< 4)) == << 4) && (player & ((<< 6) << (val 2))) && ((player & (<< 2) >> (val 2))));
    }

    function 
    lose() {
        
    cm.sendNext(loadText(false) + "\r\n\r\nIt's a shame that you have lost againts this computer. You should try again after you take your breakfast, you're probably just tired.");
        
    cm.dispose();
    }

    function 
    computerMoves() {
        if (
    playerFlag == 0) {
            var 
    rand Math.random() * 0;
            
    computerFlag |= << (rand == rand 4);
        } else {
            if (
    computerFlag == 0) {
                for (var 
    04i++) {
                    if (
    playerFlag & (<< i) == << i) {
                        
    computerFlag |= << 4;
                        return;
                    }
                }
                var 
    rand Math.random() * 0;
                if (
    playerFlag == << 4) {
                    
    computerFlag |= << (rand == rand 0);
                } else {
                    if ((
    playerFlag 1) << (rand == rand 4) != << (rand == rand 4)) {
                        
    computerFlag |= << (rand == rand 4);
                    } else {
                        
    computerFlag |= << 4;
                    }
                }
            } else {
                for (var 
    09i++) {
                    if (((
    computerFlag playerFlag) & (<< i)) != 0) {
                        continue;
                    }
                    var 
    nextMove = (computerFlag | (<< i));
                    for (var 
    03x++) {
                        if (
    isWinner(nextMovex)) {
                            
    computerFlag |= << i;
                            return;
                        }
                    }
                    var 
    playerPossibleMove = (playerFlag | (<< i));
                    for (var 
    03x++) {
                        if (
    isWinner(playerPossibleMovex)) {
                            
    computerFlag |= << i;
                            return;
                        }
                    }
                }
                for (var 
    09i++) {
                    if (((
    computerFlag playerFlag) & (<< i)) != 0) {
                        continue;
                    }
                    
    computerFlag |= << i;
                    break;
                }
            }
        }
    }

    function 
    loadText(sendSimple) {
        var 
    text = (sendSimple "Pick your move." "Match Result.") + "\r\n\r\n";
        for (var 
    09i++) {
            
    text += ((playerFlag & (<< i)) == (<< i) ? "#i" playerColor "#" : (computerFlag & (<< i)) == (<< i) ? "#i" computerColor "#" : ((sendSimple "#L" "#" "") + "___")) + "\t\t" + (((1) % == "\r\n" ""));
        }
        return 
    text;
    }

    function 
    tie() {
        
    cm.sendNext(loadText(false) + "\r\n\r\nOh, looks you you tied with the computer. You're really good player, but you need to try harder.");
        
    cm.dispose();

    EDIT:

    Images added upon request:

    Begin
    Spoiler:




    Playing
    Spoiler:




    Tie
    Spoiler:




    Lose
    Spoiler:


    Last edited by XxОsirisxX; 23-07-11 at 03:27 PM.


  2. #2
    Account Upgraded | Title Enabled! PolSquiggles is offline
    MemberRank
    Jul 2011 Join Date
    201Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Osiris, you're legit.

    That is all.

  3. #3
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    PHP Code:
    he punished me hardso meanwhile my injuries are not yet sanitized
    haaaaaaaaaaah XD
    Too lazy to follow the bitwise this late, I'll probably try to decipher it tomorrow. Looks pretty well-done tho.

  4. #4
    Apprentice Xengofx is offline
    MemberRank
    Jul 2011 Join Date
    6Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Nice! LOL;D

  5. #5
    Can't kilean the zilean Darksta is offline
    MemberRank
    Oct 2010 Join Date
    Down undah mateLocation
    1,582Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    "Okay so, I made a bet with Moogra meanwhile playing Minesweeper. I lost with a score of 25 - 26. Which is sad because he just cheated somehow. :(

    Anyhow, making up my word as a loser. I had to release anything to RaGEZONE. He knows I hate to release, so he is probably with a huge smiley in his face while eating tacos. (Yes, Moogra is Mexican).

    Okay, so, on topic. This is the NPC I made for my lose :(.

    Don't enjoy it."

    somad!

  6. #6
    Account Upgraded | Title Enabled! SuperLol is offline
    MemberRank
    Jun 2010 Join Date
    801Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    26-23 you mean.

  7. #7
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Quote Originally Posted by SuperLol View Post
    26-23 you mean.
    24 perhaps? I forgot... But yeah, pretty close to win. :'<

    Gogogogogog waiting for your AI. :D

  8. #8
    bleh.... Shawn is offline
    MemberRank
    Oct 2008 Join Date
    Mississauga, CaLocation
    5,904Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Tested and working? You know I'd have to remove it if it's not :( It'd be unfortunate because I enjoy seeing people start to branch out with NPCs and create new mini games :(

    Release a Bingo NPC :O

  9. #9
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Yeah, sadly I had to test it... It works. You have my word. The only thing that... is that the image position kinda sucks sometimes, but that's just esthetic... It works as intent.

    Bingo NPC sounds like, a way easier task than this thought.

  10. #10
    bleh.... Shawn is offline
    MemberRank
    Oct 2008 Join Date
    Mississauga, CaLocation
    5,904Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Quote Originally Posted by XxОsirisxX View Post
    Yeah, sadly I had to test it... It works. You have my word. The only thing that... is that the image position kinda sucks sometimes, but that's just esthetic... It works as intent.

    Bingo NPC sounds like, a way easier task than this thought.
    MSN, I'll explain the concept :p

    As for the image factor, what's the issue with it? I can't tell since you didn't include screenshots. Not aligned properly? You forget the \t option ?

  11. #11
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Quote Originally Posted by Shawn View Post
    MSN, I'll explain the concept :p

    As for the image factor, what's the issue with it? I can't tell since you didn't include screenshots. Not aligned properly? You forget the \t option ?
    I do use \t. Thing is that the image changes size because of..

    1. I switch between sendSimple and sendNext.

    2. I I use ASCII, which change size, I should of use some invisible item I guess.

    That's about it.

  12. #12
    Smoke & Fly Kars is offline
    MemberRank
    Apr 2008 Join Date
    The NetherlandsLocation
    3,383Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    You know you're the NPC god here Ozzy. I can barely understand this script. Which must mean it's good. So well done.

  13. #13
    Alpha Member XxОsirisxX is offline
    MemberRank
    Aug 2009 Join Date
    2,727Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Quote Originally Posted by Kars View Post
    You know you're the NPC god here Ozzy. I can barely understand this script. Which must mean it's good. So well done.
    When I re-read it quickly, I don't get it either. Thanks Karshy. ^^

  14. #14
    Account Upgraded | Title Enabled! yogiram1235 is offline
    MemberRank
    Aug 2008 Join Date
    In Hood-ville.Location
    268Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    Why are you a girl? o.O

    OT: I've seen this NPC before. Might be thinking of something else, but good job :)

  15. #15
    Infraction Banned Strobe is offline
    MemberRank
    Jul 2011 Join Date
    208Posts

    Re: [Add-on] Tic-Tac-Toe NPC. Moogra is mean.

    lol whenever i played moogra i would lose like 26-4 so yeah...



Page 1 of 2 12 LastLast

Advertisement