Jump to content

A Game we can play online !

Featured Replies

  • Author

 

| | |

| | | |

| | | | | |

My turn, I removed row 1

----------

edit, in my analysis, I am player A because I am the first to have removed a row. You are player B

 

 

And I do :

 

| |

| | | |

| | | | | |

  • Author

 

| |

| | | |

------------------

 

A A

 

 

Now :

 

| |

| |

  • Author

 

You win wathever I do now

 

Anyway I play this

|

| |

 

 

Yes, I remove 2 and leave 1

 

Nice that you are approaching logically.

 

Good try

Edited by Commander

Commander,

 

OK. You move first.

 

Regards, TAR

  • Author

Commander,

 

OK. You move first.

 

Regards, TAR

 

TAR ,

 

Alright, here we go.

 

I think you have now analyzed well and I might have a tough time.

 

Regards, Thomas

 

|

| |

| | | | |

| | | | | | |

Edited by Commander

Commander,

 

Yes, I should be a little more nimble, and a bit more of a challenge.

 

| |

| | | |

| | | | | |

 

 

 

Regards, TAR

  • Author

Commander,

 

Yes, I should be a little more nimble, and a bit more of a challenge.

 

| |

| | | |

| | | | | |

 

 

 

Regards, TAR

 

Hi, there was an error on the initial board

 

You need to move now.from :

 

|

| |

| | | | |

| | | | | | |

Commander,

 

Sorry, I didn't notice the error.

 

 

| |

| | | | |

| | | | | | |

Regards, TAR

  • Author

Commander,

 

Sorry, I didn't notice the error.

 

 

| |

| | | | |

| | | | | | |

Regards, TAR

 

TAR :

 

Let me try :

 

 

| |

| | | | |

| | | |

 

 

Regards , Thomas

Commander,

 

I will try this.

 

|

| | | | |

| | | |

Regards, TAR

  • Author

Commander,

 

I will try this.

 

|

| | | | |

| | | |

Regards, TAR

 

TAR :

 

Now this :

 

 

|

| | | | |

| | |

 

Regards, Thomas

Commander,

 

|

| |

| | |

Regards, TAR

  • Author

Commander,

 

|

| |

| | |

Regards, TAR

 

 

TAR :

 

You got me there.

 

Well done. Well played !

 

 

Regards, Thomas

  • 2 months later...
The expert Programmers here like Sensei, fiveworlds , Janus etc can improve on the online implementation of this.

 

 

Well since you asked so nicely. I made the game with zero security and it will allow a player to make as many moves as they want so be honest.

<?php
if(file_exists("matchsticks.txt")){
    $matches=file_get_contents("matchsticks.txt");
    if($matches==="\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\""){
        $fp=fopen("matchsticks.txt","w");
        fwrite($fp,"\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\"");
        fclose($fp);
        $matches="\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\"";
        
    }
    if(isset($_REQUEST["checkbox"]))
    {
        $matches = explode(",",str_replace("\"","",$matches));
         for ($i = 0; $i < count($_REQUEST["checkbox"]); ++$i) {
            $matches[$_REQUEST["checkbox"][$i]]=0;                
        }
        $temp=NULL;
        for ($i = 0; $i < count($matches); ++$i){
            $temp=$temp."\"".$matches[$i]."\"".",";
        }
        $matches=trim($temp, ",");
        file_put_contents("matchsticks.txt",$matches);
    }
    
    echo "<script>matches=new Array({$matches});";
    loadpage();
    
}
else{
    echo "<script>matches=new Array(\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\";)";
    loadpage();
    $fp=fopen("matchsticks.txt","w");
    fwrite($fp,"\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\"");
    fclose($fp);
}

function loadpage(){
    echo "var images = new Array();
    var checkboxes = new Array();
    var table = \"\";
    var form = \"\";
    for    (index = 0; index < matches.length; index++) {
        if(matches[index]===\"1\")
        {
            images[index]=\"<img src=matchstick.jpg />\";
            checkboxes[index]=\"<input type='checkbox' name='checkbox[]' value='\"+index+\"'>\";
        }
        else
        {
            images[index]=\" \";
            checkboxes[index]=\"\";
        }
        
        if(index===0)
        {
            table+=\"<table><tr><td>\"+images[index]+\"</td><td> </td><td> </td><td> </td><td> </td></tr>\";
            form+=\"<form method=get>Row 1\"+checkboxes[index]+\"<input type='submit' value='Submit'></br></form>\";
        }
        
        if(index===2)
        {
            table+=\"<tr><td>\"+images[index-1]+\"</td><td>\"+images[index]+\"</td><td> </td><td> </td><td> </td></tr>\";
            form+=\"<form method=get>Row 2\"+checkboxes[index-1]+checkboxes[index]+\"<input type='submit' value='Submit'></br></form>\";
        }
        
        if(index===5)
        {
            table+=\"<tr><td>\"+images[index-2]+\"</td><td>\"+images[index-1]+\"</td><td>\"+images[index]+\"</td><td> </td><td> </td></tr>\";
            form+=\"<form method=get>Row 3\"+checkboxes[index-2]+checkboxes[index-1]+checkboxes[index]+\"<input type='submit' value='Submit'></br></form>\";
        }
        
        if(index===9)
        {
            table+=\"<tr><td>\"+images[index-3]+\"</td><td>\"+images[index-2]+\"</td><td>\"+images[index-1]+\"</td><td>\"+images[index]+\"</td><td> </td></tr>\";
            form+=\"<form method=get>Row 4\"+checkboxes[index-3]+checkboxes[index-2]+checkboxes[index-1]+checkboxes[index]+\"<input type='submit' value='Submit'></br></form>\";
        }
        
        if(index===14)
        {
            table+=\"<tr><td>\"+images[index-4]+\"</td><td>\"+images[index-3]+\"</td><td>\"+images[index-2]+\"</td><td>\"+images[index-1]+\"</td><td>\"+images[index]+\"</td></tr></table>\";
            form+=\"<form method=get>Row 5\"+checkboxes[index-4]+checkboxes[index-3]+checkboxes[index-2]+checkboxes[index-1]+checkboxes[index]+\"<input type='submit' value='Submit'></br></form>\";
        }
    }

    document.write(table+form);


</script>";

}
?>
  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.