All pastes #441258 Raw Edit

Chess

public php v1 · immutable
·published 2007-04-15 16:20 UTC
rendered paste body
Anyone interested? barryd.it@gmail.com<?phpclass chess {  public $board = array();  public function board($pieces) {    foreach (range('a', 'h') as $file) {      foreach (range('1', '8') as $rank) {        $this->board["$file$rank"] = "\x20";      }    }    $this->board = array_merge($this->board, $pieces);  }  public function __construct() {    $this->board(array('a1' => "\xe2\x99\x96", 'b1' => "\xe2\x99\x98", 'c1' => "\xe2\x99\x97", 'd1' => "\xe2\x99\x95", 'e1' => "\xe2\x99\x94", 'f1' => "\xe2\x99\x97", 'g1' => "\xe2\x99\x98", 'h1' => "\xe2\x99\x96", 'a2' => "\xe2\x99\x99", 'b2' => "\xe2\x99\x99", 'c2' => "\xe2\x99\x99", 'd2' =>"\xe2\x99\x99", 'e2' =>"\xe2\x99\x99", 'f2' => "\xe2\x99\x99", 'g2' => "\xe2\x99\x99", 'h2' => "\xe2\x99\x99", 'a7' => "\xe2\x99\x99", 'b7' => "\xe2\x99\x99", 'c7' => "\xe2\x99\x99", 'd7' =>"\xe2\x99\x99", 'e7' =>"\xe2\x99\x99", 'f7' => "\xe2\x99\x99", 'g7' => "\xe2\x99\x99", 'h7' => "\xe2\x99\x99", 'a8' => "\xe2\x99\x9c", "\xe2\x99\x9c", 'b8' => "\xe2\x99\x9e", 'c8' => "\xe2\x99\x9d", 'd8' => "\xe2\x99\x9b", 'e8' => "\xe2\x99\x9a", 'f8' => "\xe2\x99\x9d", 'g8' => "\xe2\x99\x9e", 'h8' => "\xe2\x99\x9c" ));    print_r($this->board);  }}$chess = new chess;echo <<<END                   Files         a   b   c   d   e   f   g   h       +---+---+---+---+---+---+---+---+     1 | {$chess->board['a1']} | {$chess->board['b1']} | {$chess->board['c1']} | {$chess->board['d1']} | {$chess->board['e1']} | {$chess->board['f1']} | {$chess->board['g1']} | {$chess->board['h1']} | 1       +---+---+---+---+---+---+---+---+     2 | {$chess->board['a2']} | {$chess->board['b2']} | {$chess->board['c2']} | {$chess->board['d2']} | {$chess->board['e2']} | {$chess->board['f2']} | {$chess->board['g2']} | {$chess->board['h2']} | 2       +---+---+---+---+---+---+---+---+     3 | {$chess->board['a3']} | {$chess->board['b3']} | {$chess->board['c3']} | {$chess->board['d3']} | {$chess->board['e3']} | {$chess->board['f3']} | {$chess->board['g3']} | {$chess->board['h3']} | 3 R     +---+---+---+---+---+---+---+---+ a   4 | {$chess->board['a4']} | {$chess->board['b4']} | {$chess->board['c4']} | {$chess->board['d4']} | {$chess->board['e4']} | {$chess->board['f4']} | {$chess->board['g4']} | {$chess->board['h4']} | 4 n     +---+---+---+---+---+---+---+---+ k   5 | {$chess->board['a5']} | {$chess->board['b5']} | {$chess->board['c5']} | {$chess->board['d5']} | {$chess->board['e5']} | {$chess->board['f5']} | {$chess->board['g5']} | {$chess->board['h5']} | 5 s     +---+---+---+---+---+---+---+---+     6 | {$chess->board['a6']} | {$chess->board['b6']} | {$chess->board['c6']} | {$chess->board['d6']} | {$chess->board['e6']} | {$chess->board['f6']} | {$chess->board['g6']} | {$chess->board['h6']} | 6       +---+---+---+---+---+---+---+---+     7 | {$chess->board['a7']} | {$chess->board['b7']} | {$chess->board['c7']} | {$chess->board['d7']} | {$chess->board['e7']} | {$chess->board['f7']} | {$chess->board['g7']} | {$chess->board['h7']} | 7       +---+---+---+---+---+---+---+---+     8 | {$chess->board['a8']} | {$chess->board['b8']} | {$chess->board['c8']} | {$chess->board['d8']} | {$chess->board['e8']} | {$chess->board['f8']} | {$chess->board['g8']} | {$chess->board['h8']} | 8       +---+---+---+---+---+---+---+---+         a   b   c   d   e   f   g   hEND;?>