首页 > > 详细

program编程辅导、c+,python程序辅导、讲解Java设计程序 解析Java程序|辅导R语言程序

项目预算:   开发周期:  发布时间:   要求地区:
Lab 6 2021 – Sample Output
The following gives you sample output from the program up to the point the game starts. You can
continue playing the game against the computer, or you can stop the game there and try the next set,
using control-c (or see the lab writeup for more about this and other suggestions).
These examples are not absolutely exhaustive tests of your code, but will give you a good overall test.
Different input values will be used in the automarking.
Example 1
>> Basic test of input and board construction
Rows are 1 - 9, Columns are 1 - 11
Orientation is 0 for across, 1 for down
Give starting row, starting column and orientation (3 inputs) for ship of size=5:3 9 1
Give starting row, starting column and orientation (3 inputs) for ship of size=4:3 5 0
Give starting row, starting column and orientation (3 inputs) for ship of size=3:4 2 1
Give starting row, starting column and orientation (3 inputs) for ship of size=2:9 4 0
Give starting row, starting column and orientation (3 inputs) for ship of size=1:9 8 0
Your board is
Cols
1 2 3 4 5 6 7 8 9 10 11
________________________________
R1| 0 0 0 0 0 0 0 0 0 0 0 |
R2| 0 0 0 0 0 0 0 0 0 0 0 |
R3| 0 0 0 0 4 4 4 4 5 0 0 |
R4| 0 3 0 0 0 0 0 0 5 0 0 |
R5| 0 3 0 0 0 0 0 0 5 0 0 |
R6| 0 3 0 0 0 0 0 0 5 0 0 |
R7| 0 0 0 0 0 0 0 0 5 0 0 |
R8| 0 0 0 0 0 0 0 0 0 0 0 |
R9| 0 0 0 2 2 0 0 1 0 0 0 |
__________________________________
Give a shot (row, col):
-----------------------------------------------------------------------------------------------------
Example 2
>> Tests invalid inputs for row, column and orientation and tests placement of one ship over another
Rows are 1 - 9, Columns are 1 - 11
Orientation is 0 for across, 1 for down
Give starting row, starting column and orientation (3 inputs) for ship of size=5:16 1 1
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=5:-4 0 1
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=5:1 1 0
Give starting row, starting column and orientation (3 inputs) for ship of size=4:1 3 1
Conflicts with ship already placed
Give starting row, starting column and orientation (3 inputs) for ship of size=4:6 1 1
Give starting row, starting column and orientation (3 inputs) for ship of size=3:9 -5 0
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=3:9 12 0
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=3:9 9 0
Give starting row, starting column and orientation (3 inputs) for ship of size=2:1 11 3
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=2:1 11 -7
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=2:1 11 0
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=2:1 11 1
Give starting row, starting column and orientation (3 inputs) for ship of size=1:3 11 1
Your board is
Cols
1 2 3 4 5 6 7 8 9 10 11
________________________________
R1| 5 5 5 5 5 0 0 0 0 0 2 |
R2| 0 0 0 0 0 0 0 0 0 0 2 |
R3| 0 0 0 0 0 0 0 0 0 0 1 |
R4| 0 0 0 0 0 0 0 0 0 0 0 |
R5| 0 0 0 0 0 0 0 0 0 0 0 |
R6| 4 0 0 0 0 0 0 0 0 0 0 |
R7| 4 0 0 0 0 0 0 0 0 0 0 |
R8| 4 0 0 0 0 0 0 0 0 0 0 |
R9| 4 0 0 0 0 0 0 0 3 3 3 |
__________________________________
Give a shot (row, col):
--------------------------------------------------------------------------------------------------
Example 3
>> Tests placement of ship over edge of board
Rows are 1 - 9, Columns are 1 - 11
Orientation is 0 for across, 1 for down
Give starting row, starting column and orientation (3 inputs) for ship of size=5:2 8 0
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=5:6 8 1
Invalid Input
Give starting row, starting column and orientation (3 inputs) for ship of size=5:2 3 0
Give starting row, starting column and orientation (3 inputs) for ship of size=4:5 5 1
Give starting row, starting column and orientation (3 inputs) for ship of size=3:7 8 1
Give starting row, starting column and orientation (3 inputs) for ship of size=2:6 10 0
Give starting row, starting column and orientation (3 inputs) for ship of size=1:9 11 0
Your board is
Cols
1 2 3 4 5 6 7 8 9 10 11
________________________________
R1| 0 0 0 0 0 0 0 0 0 0 0 |
R2| 0 0 5 5 5 5 5 0 0 0 0 |
R3| 0 0 0 0 0 0 0 0 0 0 0 |
R4| 0 0 0 0 0 0 0 0 0 0 0 |
R5| 0 0 0 0 4 0 0 0 0 0 0 |
R6| 0 0 0 0 4 0 0 0 0 2 2 |
R7| 0 0 0 0 4 0 0 3 0 0 0 |
R8| 0 0 0 0 4 0 0 3 0 0 0 |
R9| 0 0 0 0 0 0 0 3 0 0 1 |
__________________________________
Give a shot (row, col):
-------------------------------------------------------------------------------------------------
Example output on Examify
The output on Examify is different, in that the program (not your code) will print “Seed:” at the start,
and will print the computer board after the user board and not continue into playing mode. This should
not affect your function. However, as in the announcement about lab 6: To correctly generate the
computer board: Use the same order of ship placement as for the user (ie ship 5 first, then 4, 3 etc.) and
generate the parameters in the same order as for user input (row, column, orientation) using a single
use of getRand() for each parameter and you will pass the computer board in the test cases.
Here is what is generated for the first Example above in Examify:
Seed:Rows are 1 - 9, Columns are 1 - 11
Orientation is 0 for across, 1 for down
Give starting row, starting column and orientation (3 inputs) for ship of
size=5:Give starting row, starting column and orientation (3 inputs) for
ship of size=4:Give starting row, starting column and orientation (3
inputs) for ship of size=3:Give starting row, starting column and
orientation (3 inputs) for ship of size=2:Give starting row, starting
column and orientation (3 inputs) for ship of size=1:Your board is
Cols
1 2 3 4 5 6 7 8 9 10 11
________________________________
R1| 0 0 0 0 0 0 0 0 0 0 0 |
R2| 0 0 0 0 0 0 0 0 0 0 0 |
R3| 0 0 0 0 4 4 4 4 5 0 0 |
R4| 0 3 0 0 0 0 0 0 5 0 0 |
R5| 0 3 0 0 0 0 0 0 5 0 0 |
R6| 0 3 0 0 0 0 0 0 5 0 0 |
R7| 0 0 0 0 0 0 0 0 5 0 0 |
R8| 0 0 0 0 0 0 0 0 0 0 0 |
R9| 0 0 0 2 2 0 0 1 0 0 0 |
__________________________________
Computer board is
Cols
1 2 3 4 5 6 7 8 9 10 11
________________________________
R1| 2 2 0 0 1 0 0 3 3 3 0 |
R2| 0 4 4 4 4 0 0 0 0 0 0 |
R3| 0 0 0 0 0 0 0 0 0 0 0 |
R4| 0 0 0 0 0 0 0 0 0 0 0 |
R5| 0 0 0 0 0 0 0 0 0 0 0 |
R6| 0 0 0 0 0 0 0 0 0 0 0 |
R7| 0 0 0 0 0 0 0 0 0 0 0 |
R8| 5 5 5 5 5 0 0 0 0 0 0 |
R9| 0 0 0 0 0 0 0 0 0 0 0 |
__________________________________

软件开发、广告设计客服
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 9951568
© 2021 www.rj363.com
软件定制开发网!