CS111 & EIE111 -- C++ Programming 2023 Spring
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Homework 1 -- Board
CS111 & EIE111 -- C++ Programming 2023 Spring
I Introduction.
There are many fantastic board games. It is possible write programs to play these games on computer. For example, a chess board as shown by the above image [1], can be printed textually like the following [2]:
In this project, we will write a C++ class Board that can represent a board.
II. Knowledge coverage
This assignment will cover the knowledge of C++ programming in at least the following aspects
1. Class declaration.
The open part, i.e., the public members, which form the interface to users,
The hidden part, i.e., the private members.
Design: what are open and what are hidden.
2. Relationship between .h and .cpp files.
3. Static members, declaration and defi nition.
4. Allocating spaces (two dimensional array) on the Heap. Deleting these spaces.
5. Constructors and destructor
6. Deep copy between objects.
7. Methods (function members), declaration and defi nition.
8. Inline methods.
9. Friend functions (part of the interface).
10. Overloaded operators
III Tasks
There are three provided code files:
board.h : It is designed for the declaration code of the class Board . It has missing code.
board.cpp : It is designed for the defi nition code of the class Board . It has missing code. test_board.cpp : It contains the main function. The methods of Board are tested by the code in this file.
There are around 50 numbered tasks (each task is providing some missing code) mentioned in the two files board.h and board.cpp . The comments in these two files indicate the tasks and requirements. The code in the text_board.cpp also has important clues on the implementing these tasks.
You are welcome to add more content in the provide code files. Just put some comments and around your code.
You can describe your work (what are done, what are not done) in text report file (like readme.txt), or in the provided Excel file.
III.1 Bonus tasks (not required)
You can design some extra features of the Board class. These can be considered as the bonus work. For example, you can write some functions for rotating the board. For example, a function rotate can accept an integer that is a multiple of 90,
Board x;
x.rotate(270);// <Extra task 1> rotate the board of x clockwise 270 degree.
x.print();
x/(-180) ; // <Extra task 2> testing the overloaded operator for rotation.
// Here, the board is rotated board 180 degree counterclockwise.
Modify the |
board.h
|
and |
board.cpp |
for declaring and defi ning the extra functions. Add some code in |
test_board.cpp to test these functions. Put some comments around the code of the extra tasks. like:
/*
IV Grading policy
A self-grading Excel file will be uploaded to Moodle. You should fill this file upload with other files. This file can help you to estimate the score of your homework.
If code cannot compile, around 15% will be deducted.
If there are some bonus work, at most 5% extra points will be awarded. Depending on the quality of the
code.
Late submission will have reduced points depending to amount of latency. However late submission will be
much better then no submission.
Code with bad alignment and indenting will have -2% penalty.
The code files of your homework CANNOT be shared publicly on the web.
IV. Submission
You are encouraged to do this homework alone without cooperating with other students. I.e. a one-person group is perfectly ok.
At most three students can form a group to submit the homework together. Group members can share code and discuss about the homework sufficiently. But sharing between groups are not allowed. Each group should do the homework independently.
Only one member of the group should submit the homework files. Make sure the names and class info (EIE/CS D1/D2) of all the group members are mentioned in a report file.
Upload the following files at the website of this homework on Moodle:
All the source code files (.c, .h)
The Excel file of self-grading.
A report file (.doc or .docx). If you have described all information in the excel file, this report file is not needed.
Deadline: 11 pm Saturday April 15 2023
V. Some suggestions and requirements
Make sure your code can compile. You are suggested to implement and test the two parts and separately:
The code of menu and interaction.
The code of printing shapes.
Do not submit the binary files (.o, .obj, .exe, .out) of your program. Do not submit some "project: file of some
integrated development environment (IDE).
You can add some code at the beginning of the main function, so that your all the names of the group member (maybe just one member) can be printed.
References
[1] "How To Set Up A Chessboard"
https://www.chess.com/article/view/how-to-set-up-a-chessboard
[2] "3D GRAPHICS ENGINE"
https://www.jon.engineering/graphics-engine.html
[4] "C++ Primer Plus", Stephen Prata, edition 6, ISBN :978-0321-77640-2, Pearson
[5] "C Primer Plus, 6th Edition", 6th Edition, Stephen Prata, 2014, Addison-Wesley Professional.
[6] "cppreference.com reference"
[7] "cplusplus.com reference"
https://cplusplus.com/reference/
2023-05-31
Homework 1 -- Board