Starting from:

$30

CSC3150 Assignment 2

CSC3150 Assignment 2
In Assignment 2, you are required to complete the multithread program to implement
the game “Frog crosses river”.
Game rules:
• A river has logs floating on it, and a frog must cross the river by jumping on the
logs as they pass by.
• Objects
- Log =================
- Frog 0
- River bank |||||||||||||||||||||
• When the game starts, the frog stands in the middle of bottom bank of river.
• The user can control the frog jumps by keyboards:
- W: UP
- S: Down
- A: Left
- D: Right
- Q: Quit the game
• The logs will move from left to right or right to left staggerly.
• You will win if the frog jumps to the other bank of river successfully.
• You will lose if the frog lands in the river, or the log reaches the left/right side of
the river but the frog still on it.
Function Requirements(90 points):
• To run the template, you will see the frog stands in the middle at bottom bank of
river. There are 9 blank rows which means the river. Compile the program to see
the static output. (5 points)
• You should complete the function named “logs_move” to let the logs can move
staggerly from left to right or from right to left. (20 points)
• You should create pthread and use mutex lock for logs and frog movement
control. (30 points)
• “kbhit” function is provided for keyboard capture. You should complete the jump
rules for keyboard actions. And the frog’s position should be updated when
keyboard hits. (15 points)
• When the logs are moving, the program should be able to judge the game status
(win, lost or quit). Print out the message for user whether he/she wins or lost the
game. (15 points)
• If the user quits the game, print the message. (5 points)
Demo Output
• Demo output for user wins the game
• Demo output for user loses the game:
• Demo output for user quits the game:
Report (10 points)
Write a report for your assignment, which should include main information as below:
• How did you design your program? Where did you place the mutex lock and
why?
• What problems you met in this assignment and what is your solution?
• The steps to execute your program.
• Screenshot of your program output.
• What did you learn from this assignment?
Submission
• Please submit the file as package with directory structure as below:
 CSC3150_Assignment_2_(Student ID)
- Source
o hw2.cpp
- Report
• Due date: End of 30 Oct, 2018
Grading rules
Completion Marks
Bonus 0 ~ 10 points
Report 10 points
Completed with good
quality
80 ~ 90
Completed accurately 80 +
Fully Submitted
(compile successfully)
60 +
Partial submitted 0 ~ 60
No submission 0
Late submission Not allowed

More products