Project: TicTacToe Game

本项目介绍了一个Tic-Tac-Toe游戏的实现方法,包括创建一个3x3的游戏面板,允许两名玩家轮流放置标记,并检查游戏是否获胜或平局。还提供了进阶功能,如自定义符号、随机决定先手及撤销一步操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

High-level language programming project

Total class hours64       Theory class hours0     Practice class hours64

Title: TicTacToe Class

Introduction:

1

 

2

 

2

 

2

 

1

The Tic-Tac-Toe game is played on a 3-by-3 board like the figure above. Two players alternate at placing 1's and 2's into 3 x 3 playing field. Before the game starts, both players have to agree about who will go first and who will mark his moves with which symbol. After the first move, the players alternately place their marks in any empty square. The goal of the game is to be the first player with three marks in a horizontal, diagonal or vertical line. If there are no empty cells and neither player has a winning combination, the game is a draw.

Basic requirements:

Create a class TicTacToe that will enable you to write a complete program to play the game of tic-tac-toe.

1. The class contains as private data a 3-by-3 two-dimensional array of integers.

2. The constructor should initialize the empty board to all zeros.

3. Allow two human players. Wherever the first player moves, place a 1 in the specified square. Place a 2 wherever the second player moves. Each move must be to an empty square.

5. After each move, determine whether the game has been won or is a draw.

Advanced requirements:

If you feel ambitious, modify your program to achieve some advanced features.

1. Users can specify the two symbols which will be used for marking the moves. Generally, these two symbols are defaulted as "1","2". Each symbol corresponds to one player.

2. The system automatically randomly determines which symbol will be marked first.

3. The system supports to go back with one move.

Marking criterion

Total score 100pts

1. functions of basic requirements 50%

2. functions of advanced requirements 20%

3. style of programming 10%

4. report 10%

5. defense 10%

Late submission will be punished.

1) 1~3 day late-> -10pts

2) 3~5 days late-> -20pts

3) >=5 days late-> -50pts


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值