コード例 #1
0
ファイル: BoardTemplate.php プロジェクト: Gtvar/Ticki
 /**
  * Simple draw board
  *
  * @param Board $board
  *
  * @return string
  */
 public static function draw(Board $board)
 {
     $out = $line = '';
     $set = $board->getKitCells();
     /** @var \Ticki\Core\Model\Cell $value */
     foreach ($set as $pos => $value) {
         $template = $pos <= 9 || $value !== null ? "  %s " : " %s ";
         $line .= sprintf($template, $value ? self::formatType($value->getType()) : $pos);
         if ($pos % $board->getSideCount() == 0) {
             $out .= $line . "\r\n";
             $line = '';
         }
     }
     return $out;
 }