Skip to content

Commit

Permalink
1ターン分の処理を実装 #2
Browse files Browse the repository at this point in the history
Boardのスケルトン作成
  • Loading branch information
ebinase committed Sep 8, 2021
1 parent 98734f9 commit 5f2f8cd
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions packages/Domain/Board/Board.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Packages\Domain\Board;

class Board
{
// TODO: arrayable検討
private $board;

const BOARD_SIZE_COLUMN = 8;
const BOARD_SIZE_ROW = 8;

public function __construct(array $board)
{
// 行数チェック
if (count($board) != self::BOARD_SIZE_ROW) {
throw new \Exception('lack of row');
}

// 各行の列数チェック
foreach ($board as $row) {
if (count($row) != self::BOARD_SIZE_COLUMN) {
throw new \Exception('lack of column');
}
}

$this->board = $board;
}

/**
* 盤面を取得
*
* @return array
*/
public function getBoard()
{
return $this->board;
}

/**
* 何も置かれていない場所の数を取得
*
* @return void
*/
public function getRest()
{
//
}

/**
* 片方の色の石の数(=得点)を取得
*
* @param [type] $color
* @return void
*/
public function getScore($color)
{
//
}

/**
*
*
* @param [type] $color
* @return boolean
*/
public function isPlacable($color)
{
//
}

public function update()
{
//
}
}

0 comments on commit 5f2f8cd

Please sign in to comment.