Show tic-tac-toe game scenario diagram

Assignment Help Programming Languages
Reference no: EM13324923

Prepare a scenario diagram for Problem

Problem 1:

Here is an interaction in a tic-tac-toe game, with user input in bold:
>> gm = Game.new('andy', 'mike')

=> #<Game:0x2e91d78 @players=[Andy, Mike]>

>> gm.play_game('mike')

Mike, enter your next O move (1-9): 1
O - -
- - -
- - -

Andy, enter your next X move (1-9): 3
O - X
- - -
- - -

Mike, enter your next O move (1-9): 5
O - X
- O -
- - -

Andy, enter your next X move (1-9): 3

Bad move dude! You go again.
O - X
- O -
- - -

Andy, enter your next X move (1-9): 6
O - X
- O X
- - -

Mike, enter your next O move (1-9): 9
O - X
- O X
- - O

Mike, you won!
=> nil
>> gm.play_game('karen')

I don't know that player. Please try again. => nil

>> gm.play_game('andy')
Andy, enter your next O move (1-9): 5
- - -
- O -
- - -
When a new game is created, two players register with it by name (the arguments to Game.new). The play_game message is called with one of the player's names and starts a new game where that player plays first using the O marker. (A game can be sent repeated play_game messages so the same pair of players can play multiple games). In each iteration, the current player is prompted for the position of her move and then she enters the move number, where the nine squares are numbered in row-major order from 1 through 9. If a move is illegal (i.e., already occupied), the current player is scolded and prompted again for a move. After each move, the board is redrawn. A game ends when either one of the players forms a horizontal, vertical, or diagonal row of her three markers (in the usual way), or the board is full indicating a tie.

The assignment is not to implement this game in Ruby. Rather, the assignment is to use scenario diagrams to discover the objects, their responsibilities, and the messages they respond to. Specifically, focus on the scenario of a typical iteration: If the current game is not over, the current player is prompted for a legal move which she supplies and then the move is made and the current game board is displayed. Hand in a single scenario diagram that you believe represents your best design.

Reference no: EM13324923

Questions Cloud

Brief discussion for problem : Brief discussion for Problem - What does the following transcript teach us
Impact of the islamic culture on modern western culture : Consider the impact of the Islamic culture on modern western culture? How has contemporary culture been influenced by these cultures?
Explain diffusible throughout the matrix of the mitochondria : In the intermembrane space, attached to the inner mitochondrial membrane. C. In the intermembrane space, attached to the outer mitochondrial membrane D. On the cytosolic side of the outer mitochondrial membrane E. Freely diffusible throughout the ..
Display the averaged measurements every time : The application uses hash tables - for a brief introduction, refer tothese slides . While the approach used by the simulator is very basic (using a dilated simulation clock), it is has been deemed sufficient for the purpose at hand.
Show tic-tac-toe game scenario diagram : The assignment is not to implement this game in Ruby. Rather, the assignment is to use scenario diagrams to discover the objects, their responsibilities, and the messages they respond to
Explain a mitochondrion is producing atp at a constant rate : A mitochondrion is producing ATP at a constant rate and, then, a chemical uncoupler is added. Compared to before the uncoupler was added
How long will it take her to run a mile at this speed : While running a marathon, a long-distance runner uses a stopwatch to time herself over a distance of 100. How long will it take her to run a mile at this speed
How to calculate the ph of sodium formate solution : Given 217 mL of a buffer solution that is 0.46 M formic acid and 0.27 M sodium formate, calculate the pH of this solution after the addition of 2.8 mL of 6.3 M hydrochloric acid. The Ka of formic acid is 1.8x10-4
With what temperature does the air emerge : The rear end of an air conditioner dumps 1.2 * 10^7 J/hr of waste heat into the air outside a building. A fan assists in the removal of this heat. With what temperature does the air emerge

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a program to print average grade of student

Write a program that read the grades.txt file and then prints the average grade of male and female students and the number of passed students by using the functions.

  Creating method to union the interface for adt bag

Add method union to  interface BagInterface for ADT bag which returns as new bag the union of bag receiving call to method and bag which is the method's one argument.

  Values of variables of logical section of the pseudocode

What are the values of variables a, b, and c after each line of code of each logical section of the pseudocode. Show why the logical section is running.

  Write program to prints question do you want to continue

Write a program which prints question"do you want to continue?"and reads user input. if user input is"y", "yes", "ok", "sure", or "why not?" , print out "ok".

  Discussion: html/css

Discussion: HTML/CSS,  "JavaScript Placement"  Please respond to the following: Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page. If so, explain wh..

  Create memo to grace to outline purposes of organization

Create a memo to Grace in which you outline purposes of organization and costs and benefits of becoming a member.

  Determine total cost of order-display it in alert dialog box

After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box.

  Write program that asks user for initial

Write a program that asks a user for his/her first initial. Then ask the user to type 1,2 3, 4. When the user types 4 the program ends. When the user types in 1, 2, or 3 , the program displays the message.

  Write program to store people-s name-phone numbers in array

Write down the program which has the array of at least ten string objects which hold people's name and phone numbers.

  Program to execute on cse unix environment

Your program should be written in C++, execute correctly on CSE unix environment, and compile using g++ compiler using makefile.

  Computing return value after execution of program

Compute return value of Antony after its execution?

  Cryptic crosswords - create a simple command line program

Decipher the clue to determine the word. One of the standard tricks of cryptic crossword creators is to use anagrams

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd