首页 > > 详细

辅导C++程序、辅导讲解 Bug Buster 程序、讲解 Bug Buster 讲解数据库SQL|辅导留学生 Statistics统计、回归、迭

Homework 5 Bug Buster
Summer 2018
Due: July 26, 6pm
In this homework, you are to design a catch-bug game program where a user tries to predict the bug
position on a 4 x 4 grid.
The initial position of the bug is fixed at (3, 3). The bug may move to any cell surrounding it,
bounded by the 4 x 4 grid. Users have 5 chances to catch the bug, or the bug wins. Whenever the
bug wins or is killed, the program changes the bug picture to show the result and ends the game.
During the game, the program shows the remaining moves and the user score. The user score starts
from 100, and every unsuccessful catch reduces it by 20. Your program should also show
meaningful messages to let users know what they should do next.
Three bug pictures are given, with filenames (“bug.gif”, “bug_win.gif”, and “bug_die.gif”). We
have also given you a simple example code showing the basic program structure.
Here are some sample game pictures.
1. Users capture the bug in 4 moves

Fig. 1: Initial display Fig. 2: Show user's click Fig. 3: The bug moves but still alive Fig. 4: The bug is caught
2. If it is not caught in 5 moves, the bug wins. The program shows the happy bug. The user
should click it again to stop the program.
Here are possible error messages.
1) If the user click is outside of the grid, a message should ask the user to click inside again.
2) If the click is not next to the bug, an invalid message appears and the user should retry
without penalty. In this homework, you should design and use the following two functions:
def move(x, y):
# It returns a new, valid position for the bug.
# You should use “random.randint(-1,1)” to randomly move the bug
on both x and y positions.
# You should check if the bug stays inside of the grid. If not, do
it again.

def showClick(Win):
# It returns the position the user has just clicked.
# The cell should be highlighted briefly to let the user see where
it is.
Submission:
The submission deadline is 6pm, July 26 (Thursday).
? Grading Criteria (out of 100 points):
o Programs submitted with no syntax error (10 points)
o Create an initial window with grid and messages (10 points)
o Show bug pictures correctly (20 points)
o Move bugs randomly after user’s clicks (20 points)
o Make the bug capture decision correctly (20 points)
o Show all messages and game logic correctly (20 points)
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!