ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 10 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 28 Apr 2017 My Price 9.00

two sets of Othello rules

Using your test program, you'll be capable of playing a single game of Othello on a single computer. There are a handful of options that allow you to specify, before the game begins, how the game will be played. The program begins by reading input that selects these options; the game is then played by requiring input directly into the console that specifies a player's next move, continuing until the game is complete, at which point the program ends

 

  • Your program begins by printing a line of output specifying which of the two sets of Othello rules are supported by your program, by printing eitherFULLorSIMPLE. (See the section titledSimplified Othello rulesbelow for a description of the simplified set of rules, which you can implement for partial credit if you're unable to complete the full rules.)
    • Note that this is not a user option; this is something your program prints, before it does anything else, so we'll know (when we're grading it) how it should behave.
  • Your program then reads four lines of input, specifying the options that will be used to determine how the game will be played.
    • The first line specifies the number of rows on the board, which will be aneven integerbetween 4 and 16 (inclusive).
    • The second line specifies the number of columns on the board, which will be aneven integerbetween 4 and 16 (inclusive) anddoes nothave to be the same as the number of rows.
    • The third line specifies which of the players will move first:Bfor black,Wfor white.
    • The fourth line selects how the game is won:>means that the player with the most discs on the board at the end of the game wins,<means the player with the fewest.
  • Next, your program will read the initial contents of the board. To make it simpler to test a variety of scenarios, your game will need to support any initial arrangement of discs, so it will be necessary to read the entire contents of the board from the input. It will be appear in the input in this form:
    • Each row will occupy a single line of input, with one space separating the cells in that row. Each cell will be specified as eitherB(if a black disc is in that cell),W(if a white disc is in that cell), or.(if the cell is empty).
    • The number of rows and columns described in this way will match the number of rows and columns specified in the first two lines of the input.
    • For example, if there are 8 rows and 8 columns on the board, the initial contents of the board might appear in the input this way:
      . . . . . . . .
      . . . . . . . .
      . . . . . . . .
      . B W B W . . .
      . . . W B . . .
      . . . . B W . .
      . . . . . B . .
      . . . . . . . .
                
  • After the initial arrangement of the board is specified in the input, the game begins, proceeding one move a time until it's complete.
    • Before each turn, the following information is printed to the console:
      • The characterB, followed by a colon and a space, followed by the number of discs on the board that are black. This is followed by two spaces, the characterW, a colon and a space, and the number of discs on the board that are white.
      • The contents of the board, with each row occupying one line of output, and one space separating each pair of cells. Each cell is written either as aB(if a black tile occupies that cell), aW(if a white tile occupies that cell), or a.(if no tile occupies that cell). For example:
        . . . . . . . .
        . . . . . . . .
        . . . . . . . .
        . . . B W . . .
        . . . W B . . .
        . . . . . . . .
        . . . . . . . .
        . . . . . . . .
                      
      • The wordTURN(in all-caps), followed by a colon and a space, followed byBif it's the black player's turn,Wif it's white's turn.
    • After printing the information above, the program reads a line of input specifying the current player's move. The move is specified as two integers on a line, separated by a space. The first integer specifies the row number (with 1 being the top row, 2 being the row below that, and so on) and the second integer specifies the column number (with 1 being the leftmost column, 2 being the one to the right of that, and so on).
      • If the move is valid, print the wordVALIDalone on a line, apply that move (i.e., make the appropriate changes to the state of the game) and then continue the game..
      • If the move is invalid (see therulesif you're curious what makes a move invalid), print the wordINVALIDalone on a line and wait for the user to specify another move.
  • At the conclusion of the game (i.e., after the last move is made and there are no more legal moves on the board), the final state of the game is printed to the console, quite similarly to how it's printed before each turn:
    • The characterB, followed by a colon and a space, followed by the number of discs on the board that are black. This is followed by two spaces, the characterW, a colon and a space, and the number of discs on the board that are white.
    • The contents of the board, in the same format described above.
    • The wordWINNER(in all-caps), followed by a colon and a space, followed byBif the black player has won,Wif the white player has won, andNONEif no player has won (i.e., the final score is tied).

The program ends when the game is over.

 

You are required to keep the code that implements the game logic entirely separate from the code that implements your console-mode user interface. To that end, you will be required to submit at least two modules: one that implements your game logic and another that implements your user interface. You're welcome to break these two modules up further if you find it beneficial, but the requirement is that you keep these two parts of your program — the logic and the user interface — separate.

Note that this requirement is motivated partly by a desire to build good design habits, but also by the practical reality that maintaining that separation properly will give you a much better chance of being able to reuse your game logic, as-is and without modification, in the next project, when you'll be asked to build a graphical user interface for your game. In a big-picture sense, you can think of the user interface in this project as being a "throwaway"; while we'll be using it to grade your game logic, the true goal here is the complete version of Othello with a graphical user interface. So keeping this "throwaway" code completely separate from your game logic means that it will be easy to leave it out of your completed version, without causing anything else to break.

I need an original answer, not code that has already been posted to the website

Answers

(11)
Status NEW Posted 28 Apr 2017 01:04 AM My Price 9.00

-----------

Not Rated(0)