Demo Project 2 Milestone 3 Part 1

Demo Project 2 Milestone 3 Part 1

You cannot submit for this problem because the homework's deadline is due.

Milestone 3

Submission requirements

Submit terminal.c and main.c here.

Tasks
Task1: Helping message & Version Information

Implement the function help() and version() in terminal.c. Then complete main() in main.c. You only need to write few lines on your own!Most of the things are copy and paste! :smile:

For the helping message, you should print the following. This should be implemented in help().

 % ./reversi -h
Usage: ./reversi [OPTIONS]

A local multiplayer Reversi game.

Options:
  -h|--help    Print this help message
  -v|--version Print version information

Commands:
  AUTO          Automatically process the game by always placing the first valid disk
  DONE          Manually exit the game
  LOAD filename Load the game status from the specified file, e.g. LOAD sample.txt
                If the filename does not exist, sample.txt will be loaded by default
  PLACE x y     Place a new disk at position (x, y), e.g. PLACE 3 c
  PRINT         Print current board
  SAVE filename Save the game status to the specified file, e.g. SAVE sample.txt
                If the filename does not exist, it will be automatically created

For the version information, you should print. This should be implemented in version().

 % ./reversi -v
Reversi version 0.0.1

Hint: use puts() instead of printf("\n")

Otherwise, you should print Unknown argument!, if there are more than one extra arguments (argc>2), you should print Too many arguments!.

 % ./reversi -vv
Unknown argument!
 % ./reversi -v -h
Too many arguments!

Lab 9 Exercises

Not Claimed
Status
Finished
Problems
5
Open Since
2022-07-14 18:15
DDL
2022-07-16 23:59
Extension
0.0 hour(s)