# GameManagerClassの修正

### 改修したPlayerクラスを適用する

board\_stateをgets\_piece\_locationメソッドで受け取れるようにしたので、それに関連する箇所を修正しましょう。

<pre class="language-ruby"><code class="lang-ruby"># 説明: プレイヤーがコマを配置する場所を取得してターンを進める
# 引数: なし
# 戻り値: なし
<strong>def player_turn
</strong>  row, col = @current_player.gets_piece_location(@board.board_state)
  @board.update(row, col, @current_player.piece)
rescue TicTacToeInputError => e
  puts ""
  puts e.message
  puts ""
  player_turn
rescue ComError => e
  puts ""
  puts e.message
  puts ""
 rescue e
   raise e
 end
</code></pre>

### テストの修正

今の状態だとgame\_manager\_test.rbは落ちるので修正します。

{% hint style="info" %}
**課題コーナー**

game\_manager\_test.rbを修正して通過させる
{% endhint %}

参考コードは以下のURLから参照してください。

{% embed url="<https://github.com/Kashiwara0205/ruby-tic-tac-toe/blob/master/ch5/code/test/game_manager_test.rb>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kashiwara.gitbook.io/rubydesurufurusukuratchibe/zui-zhong-zhang-ji-neng-zhui-jia/gamemanagerclassno.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
