Sale!

CSC 3150 Assignment 2 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

CSC3150 Assignment 2
Task Description
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. The logs will move from left to right or right to left staggerly. Please take care of the edge
cases.
W: UP
S: Down
A: Left
D: Right
Q: Quit the game
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 reaches the left/right side of the river.
Please note that this is a game. If the player suffers from extereme difficulty, high latency, and other
unexpected situations for a game, your grade will suffer as well.
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
You win the game!!
main@ubuntu:~/Desktop/Assignment_2_example/source$
Demo output for user loses the game:
You lose the game!!
main@ubuntu:~/Desktop/Assignment_2_example/source$
Demo output for user quits the game:
You exit the game.
main@ubuntu:~/Desktop/Assignment_2_example/source$
Bonus Task (10 pionts)
You have to implement a graphical output of your river and frog game. (5 points)
You can use any library you like to show your graphical output
The length of log must be different by random generating. (2 points)
You need to design a slide bar to adjust the speed of floating logs. (3 points)
Report (10 points)
Write a report for your assignment, which should include main information as below:
Your name and student id.
How did you design your program?
The environment of running your program. (E.g., version of OS and kernel)
The steps to execute your program.
Screenshot of your program output.
What did you learn from the tasks?
Grading rules
Here is a sample grading scheme. Different from the points specified above, this is the general guide when TA’s
grading.
Completion Marks
Bonus 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
C
o
m
ple
tio
n
M
a
r
k
s
L
a
t
e
s
u
b
mis
sio
n
N
o
t
allo
w
e
d