官术网_书友最值得收藏!

Tic-Tac-Toe game requirements

Tic-Tac-Toe is most often played by young children. The rules of the game are fairly simple.

Tic-Tac-Toe is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row, wins the game.

For more information about the game, please visit Wikipedia ( http://en.wikipedia.org/wiki/Tic-tac-toe).

More detailed requirements will be presented later on.

The exercise consists of the creation of a single test that corresponds to one of the requirements. The test is followed by the code that fulfills the expectations of that test. Finally, if needed, the code is refactored. The same procedure should be repeated with more tests related to the same requirement. Once we're satisfied with tests and the implementation of that requirement, we'll move to the next one until they're all done.

In real-world situations, you wouldn't get such detailed requirements, but dive right into tests that would act as both requirements and validation. However, until you get comfortable with TDD, we'll have to define requirements separately from tests.

Even though all the tests and the implementation are provided, try to read only one requirement at a time and write tests and implementation code yourself. Once done, compare your solution with the one from this book and move to the next requirement. There is no one and only one solution; yours might be better than the ones presented here.

主站蜘蛛池模板: 沙坪坝区| 望谟县| 南城县| 成武县| 广东省| 玉屏| 钟山县| 会泽县| 会宁县| 珲春市| 霍邱县| 松阳县| 柘荣县| 陆河县| 灌云县| 桦川县| 克东县| 阿合奇县| 墨竹工卡县| 蓝田县| 新郑市| 麦盖提县| 慈利县| 泾源县| 通城县| 浦城县| 措美县| 永康市| 宿迁市| 宾川县| 宝山区| 富川| 西充县| 宁城县| 滁州市| 永昌县| 香河县| 德州市| 东阿县| 乐昌市| 庆阳市|