User Profile

Collapse

Profile Sidebar

Collapse
j0k3r
j0k3r
Last Activity: Jun 1 '08, 08:08 PM
Joined: May 28 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    OMG i'm so stupid.. the notckd function is totally wrong.. i just had to use "in_array" *_*

    (code)

    Result:
    Code:
    checkSpot( 1, 1, 1 )
    Friendly piece. Continue pathing.
    
    Array
    (
        [0] => 1,1
    )
    
    checkSpot( 0, 1, 1 )
    Edge of the board or enemy piece. Life is over.
    
    checkSpot( 2, 1, 1 )
    Friendly piece. Continue pathing.
    ...
    See more | Go to post

    Leave a comment:


  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    It only works for the first set of coordinates.. let's say the board is:

    Code:
    1	1	1	0
    0	0	2	0
    0	0	2	0
    0	0	0	0
    (just using '1' (= o) and '2' (= x), 'cause in the DB is set as INT and i don't want to change it now eheh)

    here's the code:
    http://www.nomorepasting.com/getpaste.php?pasteid=16366

    the result is:
    Code:
    checkSpot( 1, 1, 1 )
    Friendly piece.
    ...
    See more | Go to post

    Leave a comment:


  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    [PHP]
    function checkSpot( $ind_X, $ind_Y, $myColor )
    {
    global $theBoard;
    //$checked is the array containing the positions "x,y"
    global $checked;
    //just the html version of print_r
    show($checked);
    //this returns everytime true (i never see this text)
    if (!notckd($ind_X ,$ind_Y)) { echo "Already...
    See more | Go to post

    Leave a comment:


  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    Ok, now it's a bit i'm thinking about it and while making it search in 4 direction instead of 2 is quite easy (just adding $theBoard[$ind_X][$ind_Y] and 2 other "or" statements, isn't it ?).. making it check every stone is.. a problem.

    I mean... if we have this:

    Code:
    [ ]  [o]  [ ]  [ ]
    [o]->[o]  [o]  [ ]
    let's say it starts from the upper stone, it sets the upper stone "1"...
    See more | Go to post

    Leave a comment:


  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    wow, i love you :P

    i see what you mean with tricky.. sure it is :S

    i'll work on it today :) thx
    See more | Go to post

    Leave a comment:


  • j0k3r
    replied to Go Simulation - Mark dead stones
    in PHP
    Hi, it's working - just doesn't do what I need :)

    It schould be something like this, when I add a stone I'd call this function that:
    1) checks the stones nearby (ok)
    2) if it finds some enemy stones (ok)
    ---> that's ok, it does it properly
    3) checks the stones near the enemy (that means i need to re-call the same function with the coordinates of the stone it just found)
    4) .. it loops between the...
    See more | Go to post

    Leave a comment:


  • j0k3r
    started a topic Go Simulation - Mark dead stones
    in PHP

    Go Simulation - Mark dead stones

    Hiya, i'm trying to create a Go (the game) simulation in PHP, the problem is how to mark dead stones.

    each stone has some liberties wich are the empty territories nearby, when a group of stones is completly enclosed in stones of another color, is dead.

    here the example of what i've done so far:
    http://www.k4s.ch/test/sca/test.php

    p= player [1: black, 2: white]
    x,y = [move coordinates]...
    See more | Go to post
No activity results to display
Show More
Working...