<commit_before><?php

namespace Afpa\OthelloGameBundle\Model;

/**
 * Board
 */
class Board {

    protected $aBoard;

    public function __construct() {
        // initialisation du plateau
        $this->aBoard = array();
        for ($i = 0; $i < 8; $i++) {
            $this->aBoard[$i] = array();

            for ($j = 0; $j < 8; $j++) {
                $this->aBoard[$i][$j] = NULL;
            }
        }

        // insertion des pions de départ
        $this->aBoard[3][3] = new WhitePawn;
        $this->aBoard[3][4] = new BlackPawn;
        $this->aBoard[4][3] = new BlackPawn;
        $this->aBoard[4][4] = new WhitePawn;
    }

    public function getBoard() {
        return $this->aBoard;
    }

    public function setBoard($aBoard) {
        $this->aBoard = $aBoard;
    }

}<commit_msg>maj board.php ard<commit_after><?php

namespace Afpa\OthelloGameBundle\Model;

/**
 * Board
 */
class Board {

    protected $aBoard;
    protected $aPossibleCases;

    public function __construct() {
        // initialisation du plateau
        $this->aBoard = array();
        for ($i = 0; $i < 8; $i++) {
            $this->aBoard[$i] = array();

            for ($j = 0; $j < 8; $j++) {
                $this->aBoard[$i][$j] = NULL;
            }
        }

        // insertion des pions de départ
        $this->aBoard[3][3] = new WhitePawn;
        $this->aBoard[3][4] = new BlackPawn;
        $this->aBoard[4][3] = new BlackPawn;
        $this->aBoard[4][4] = new WhitePawn;

        // initialisation du tableau des cases cliquables
        $this->calculPossiblesCases();
    }

    public function calculPossiblesCases() {
        $this->aPossibleCases = array();

        $k = 0;
        for ($i = 0; $i < 8; $i++) {

            $this->aPossibleCases[$k] = array();

            for ($j = 0; $j < 8; $j++) {
                $this->aPossibleCases[$k][0] = $i;
                $this->aPossibleCases[$k][1] = $j;
                $k++;
                if ($k % 8 == 0) {
                    $k--;
                }
            }
            $k++;
        }
        /* echo '<pre>';
          echo 'tableau des cas possibles : ';
          print_r($this->aPossibleCases);
          echo '</pre>'; */
    }

    public function PossibleCases() {
        $aPossibleCase = array();
        $l = 0;
        $c = 0;
        $k = 0;

        while ($l < 8) {
            while ($c < 8) {
                if (IsPossibleAction($l, $c, ))
            }
        }
    }

    public function IsPossibleAction($l, $c, $PawnColor) {
        $bPossible = false;
        if ($PawnColor == 'white') {
            $OppositeColor = 'black';
        } else {
            $OppositeColor = 'white';
        }
        $iNbPos = 8;
        if ($l > 0) {
            $i = $l - 1;
        } else {
            $i = $l;
            $iNbPos = $iNbPos - 3;
        }
        if (c > 0) {
            $j = $c - 1;
            $iNpPos = $iNbPos - 3;
        }
        if ($l == 7) {
            $FinL = $l + 1;
            $iNbPos = $iNbPos - 3;
        } else {
            $FinL = $l + 2;
        }
        if ($c == 7) {
            $FinC = $c + 1;
            $iNbPos = $iNbPos - 3;
        } else {
            $Finc = $c + 2;
        }
        if (($l == 0 && c == 0) || ($l == 0 && $c == 7) || ($l == 7 && $c == 0) || ($l == 7 && $c == 7)) {
            $iNbPos++;
        }
        $Way = 0;
        while (!bPossible && $iNbPos != 0 && $i < $FinL) {
            while (!Possible && $iNbPos != 0 && $j < $FinC) {
                if ($i != $l && $j != $c) {
                    if ($aBoard[$i][$j] == $OppositeColor) {
                        if (Run($l, $c, $i, $j, $PawnColor)) {
                            $aDirection[$l][$c][$Way][0] = $l - $i;
                            $aDirection[$l][$c][$Way][1] = $c - $j;
                            $Way++;
                            $bPossible = true;
                        }
                    }
                    $iNbPos--;
                }
                $j++;
            }
            $i++;
        }
        return $bPossible;
    }

    public function Run($l, $c, $Li, $Co, $PawnColor) {
        $PasL = $l - $Li;
        $PasC = $c - $Co;
        $bPossible = false;
        $i = 0;
        $j = 0;
        while (!bPossible && $i > -1 && $i < 8) {
            while (!bPossible && $j > -1 && j < 8) {
                if ($aBoard[$i][$j] == $PawnColor) {
                    $bPossible = true;
                }
                $j = $j + $PasC;
            }
            $i = $i + $PasL;
        }
        return $bPossible;
    }

    public function getBoard() {
        return $this->aBoard;
    }

    public function setBoard($aBoard) {
        $this->aBoard = $aBoard;
    }

}
{'fraction_non_alphanumeric': 0.17573839662447258, 'fraction_numerical': 0.015189873417721518, 'mean_word_length': 1.174770642201835, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6708526', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1599, 'n_words': 359}