联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp2

您当前位置:首页 >> Java编程Java编程

日期:2019-12-05 10:38

Boggle Game SRS

Version 4.0

1. Introduction

1.1 Deliverables Overview

1. Boggle is a word game played with a 4x4 grid of lettered tiles. The tiles are randomly

arranged on the grid for each round of play. In each round, players have three minutes to

form as many words as possible from the grid. A word can be formed provided: (a)

successive letters are adjacent on the grid, and (b) no tile is used twice in the same word.

After each round, all players cross off any words found by more than one player. The

remaining (unique) words score points based on their length. The first player to get to a

target number of points wins the game.

2. An automated Boggle game is played on the computer and pits the computer against a

person.

3. The Boggle program will keep time, keep score, and play against the user.

4. The Boggle program will use a stored dictionary to find words, and it will also learn

words from the user during play.

1.2 Operating Environment

1. The Boggle program will run on Windows, Macintosh, and Linux platforms.

2. The Boggle program will run using the Sun Java SDK 1.5 or higher.

2. Functional Requirements

2.1 Product Services

2.1.1 Games

1. Games are played between the program and the user (the players).

2. The user may start a new game at any time.

3. A game begins with the players each having 0 points.

4. A game ends when one or both players achieve the target score.

5. The user may set the target score to any value in the range 1 to 10,000.

6. The default target score is 100.

7. The target score may be changed at any time. When changed it will cause a new game

to begin.

8. The player with the highest total points when the game ends is the winner.

9. If the players are tied when the game ends, the game is a draw.

10. A new game begins when the program is started.

11. Games are played in a series of rounds of play.

2

2.1.2 Rounds of Play

1. When the program begins, or at the end of a game, beginning a round of play starts a

new game; otherwise beginning a round of play continues a game in progress.

2. A round of play begins when the user indicates it should by pressing a round-start

button.

3. The program will generate and display a new board as indicated below at the start of a

round of play.

4. The program will show a clock counting down from 3 minutes in one-second intervals.

5. The user will have until the clock runs out to type words into an editor window.

6. A space will separate words.

7. The case of letters will not be significant.

8. When the clock runs out, the program will beep and stop accepting words from the

user, ending the round.

2.1.3 End-Of-Round Scoring

1. When a round ends, the program will check the user's word list and generate its own

word list, displaying four lists of words:

? Words generated by both players;

? Words typed by the user that are not on the board;

? Words generated by the user alone;

? Words generated by the program alone.

2. Scores for the round are assigned as follows:

? Words generated by both players score 0;

? Words typed by the user that are not on the board score 0;

? Words generated by the user alone score points for the user;

? Words generated by the program alone score points for the computer.

3. Each unique word scores points, based on word length, as follows:

Length Score

4. The total points for the players will be computed at the end of each round.

5. The following scoring information will be displayed after each round:

? round number,

? scores for each player for the round,

? total scores for each player,

? if the game ends, the winner, or that the game was a draw.

2.1.4 Dictionaries

1. The program contains a dictionary of words that it will search the Boggle board for.

2. The dictionary will initially contain about 300 common, short words, read from a

dictionary file.

3. The program will add words typed by the user to its dictionary at the end of each

round. The dictionary will continue to grow throughout execution of the program and

will not be reset between games.

4. The program will have a difficulty level that the user may set in the range 1 to 10.

5. The default difficulty level is 5.

6. The difficulty level is divided by 10 to provide the probability that a word typed by the

user will be learned by the program (thus a difficulty level of 10 means that all words

typed by the user (and not rejected) are learned by the program).

7. The difficulty level may be reset at any time and it will take effect immediately with

regard to its effect on the probability that the computer will learn a new word.

8. When the program halts, it will choose about 300 words at random from its dictionary

and write them to the dictionary file for use the next time the program is run.

2.1.5 Rejecting Words

1. Any word typed by the user is assumed by the program to be a real word and may be

added to the dictionary.

2. After a round, the user may reject any word that the use generated, thus eliminating

mistyped words.

3. Rejected words are removed from the human’s word set only.

4. The score for the latest round (and hence the total score) is recomputed after words are

rejected; only non-rejected words are used to compute scores.

4

2.1.5 The Board

1. The Boggle board will be a 4x4 grid of letters.

2. In each round of play, the letters on the board will be generated according to the

following probabilities of occurrence:

Probability Letter

1/96 J, K, Q, Y, Z

2/96 B, C, F, G, M, P, V

3/96 D, U, W, X

5/96 H, L, R

6/96 A, I, N, S, O

10/96 E, T

2.2 Error Handling

1. The program will not accept any input that is out of range for any parameter.

2. The program will accept any sequence of characters as word input.

2.3 User Interface Specifications

1. The user interface will be a graphical user interface.

2. An appendix illustrates a suggested screen layout for the user interface.

3. You can use the suggested screen layout or some version of it or you can design your

own. If you decide to design your own layout, you must ensure that you preserve all

functionality of the Boggle game as given in PA3 in additional to whatever new

functionality is added here. You must allow the user to start rounds, play multiple games,

choose difficulty levels and points needed to win, etc. You must display all of the word

lists required in PA3 as well. While you need not include all of the controls listed below,

you should enable all functionality that these require. In other words, if you design your

own layout, your program should be functionally equivalent to the items given in the

table below.

4. Should you base your solution on the suggested layout, your solution should contain the

following items:

5

Item Mechanism

2.3.3.1 Start round

button

This button should be enabled between rounds and

disabled during a round. When pressed it starts a new

round, which includes displaying a new board, displaying

the new round number, starting the timer, setting the

round scores to 0, clearing various displays, and disabling

and enabling various controls.

2.3.3.2 Board display Must be a rectangular grid of letters. It may be displayed

in labels or buttons and may be done in special colors. It

must be updated at the start of a round.

2.3.3.3 Time left

display

May be a label or a progress bar. If it is a label, it must

display the time left in the format “m:ss” where m is the

minutes digit and ss is two seconds digits. If it is a

progress bar, it must display the time left in the center of

the bar in the format m:ss” where m is the minutes digit

and ss is two seconds digits. In either case the display

must change every second. It may be a special color.

When time is up, the round is ended. When the round

ends various displays are updated, various controls are

enabled or disabled, and possibly the end-of-game display

is shown.

2.3.3.4 Word entry

control

Must be a text entry area that supports simple editing,

such as backspacing and multiple lines of text. It should

be disabled between rounds and enabled during a round.

It must be scrollable as necessary.

2.3.3.5 Difficulty

control

May be a group of radio or push buttons, a spinner, a

slider, or a text entry area. It should only allow setting

difficulty values between 1 and 10. It is always enabled

and when set it changes the game’s difficulty level

immediately. The default should be displayed at program

start-up.

2.3.3.6 Target score

control

May be a spinner, a slider, or a text entry area. It should

only allow setting the target level between 1 and 10000. It

is always enabled but when set it causes the current game

to stop (even in the middle of a round) and a new game

(not a new round) to be initiated. The default should be

displayed at program start-up.

6

2.3.3.7 Game restart

button

This button is always enabled. When pressed, it causes

the current game to stop (even in the middle of a round)

and a new game to be initiated.

2.3.3.8 Quit button This button is always enabled. When pressed, it causes

the program to halt in an orderly manner (e.g. the

dictionary is saved).

2.3.3.9 Round label Displays the current round number.

2.3.3.10 Score

display

Must be a label or collection of labels. Displays the

current human round and total scores, and the current

computer round and total scores. The round scores must

be set to 0 at the start of a round. All scores are updated as

soon as a round ends. All scores are updated as words are

rejected.

2.3.3.11 Human only

words display

May be a list or a text input area. Either way, all the

words found by the human only in a round are displayed.

This display must be cleared at the start of a round and

updated immediately after a round and as words are

rejected. It must be scrollable as necessary.

2.3.3.12 Computer

only words display

May be a list or a text input area. Either way, all the

words found by the computer only in a round are

displayed. This display must be cleared at the start of a

round and updated immediately after a round and as

words are rejected. It must be scrollable as necessary.

2.3.3.13 Common

words display

May be a list or a text input area. Either way, all the

words found by both the human and the computer in a

round are displayed. This display must be cleared at the

start of a round and updated immediately after a round

and as words are rejected. It must be scrollable as

necessary.

2.3.3.14 Rejected

words control

May be a button or a text input field. When a word is

rejected the word lists and scores must be updated

immediately. This mechanism should be enabled between

rounds and disabled during a round.

7

2.3.3.15 Invalid word

display

May be a list or a text input area. Either way, all the

words produced by the human but not on the board are

displayed. This display must be cleared at the start of a

round, and updated immediately after a round. It must be

scrollable as necessary.

2.3.3.16 End-of-game

display

A label indicating that the game is over and who won.

Depending on the outcome, it should display one of the

messages:

“Game over?you win!”

“Game over?it’s a tie!”

“Game over?the computer wins!”

5. These components shall be arranged so that related components appear together.

6. When a round ends and a player has a winning score, the game will end immediately,

even though the user will then not have a chance to reject words.

7. When the user dismisses the end-of-game message, a new game will be initiated.

8. All scores are set to 0, the round number is set to 0, and all lists are cleared when a new

game is initiated.

3. Non-Functional Requirements

3.1 Performance Requirements

1. The three-minute round timer will be accurate to within 2 seconds.

2. The program will be reliable enough to play games to 100 points.

3.2 Development Requirements

1. The user interface components of the program must be separated from the parts of the

program that implement the game itself—only strictly user interface computations should

occur in the user interface portion of the program. The remaining code will be in the

model classes from PA3 along with the FileIO class (which will remain unchanged) and

the Listener class that will respond the events generated by the graphical user interface.

2. The program will be written in Java.

3. All packages from PA3 should be maintained, although you will not need to use

BoggleTextIO. Depending on your implementation, you will likely not need to use

BoggleControl either (although you will need some of the code contained there). Your

GUI files should be placed in a package called view.gui. Your listener(s) should be in

the controller package.

3.3 Stylistic Requirements

8

1. The source code files must adhere to the style guide provided on the class web site.

Assignments missing the acknowledgments text specified in the Style Guide will receive

a 25% deduction. This must appear in the class header for each class in your project

that you wrote or modified (if you leave use a class from my PA3 solution, you do not

need to add an acknowledgement).

Summary

You may continue your development using your own code from the last assignment, the code

posted on the web site as a solution to the last assignment, or a mix of the two. You should find

that very little, if any, of the code from the last assignment needs to be changed?most of your

work will be to replace the BoggleTextIO and BoggleControl classes with the GUI and

Listener classes.

Develop your interface a bit at a time, hooking game functionality in as you go. Start with the

quit button. After this works, add the board display and start round button. After this works, add

the time left display and word entry control. And so on. Concentrate on making things work

properly, and don’t worry much about component alignment, spacing, and so forth. You can play

with this once everything works, if you have time.

GUI programming is not hard but it is time-consuming. Do not wait until the last minute to start

on this project! See the attached file for some “Hints for Swing Programming.”

Important!!!!

Your code must follow the requirements laid out in the CS159 Style Guide (see the link on

Canvas). In particular, you MUST include the wording specified for the Acknowledgments

section of the class header for each class you wrote or modified. Failure to include this

acknowledgment with the wording specified in the Style Guide will result in an automatic

deduction of 25 points.

9

10


版权所有:编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。