Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, to pass the time during long winters, the ancient Nordic people would play the two-player game of Bjorksnas . In this assignment, you'll

In Java, to pass the time during long winters, the ancient Nordic people would play the two-player game of Bjorksnas. In this assignment, you'll implement the game, but play will be against the computer.

During each round, players choose a move, which may be either Kvalfjord, Bjorksnas, Hauga, Nordli, or Slakt. The rules are:

  • Slakt beats Hauga, Kvalfjord
  • Hauga beats Bjorksnas, Nordli
  • Bjorksnas beats Slakt, Kvalfjord
  • Kvalfjord beats Nordli, Hauga
  • Nordli beats Slakt, Bjorksnas

The computer wins in the event of a tie.

Your program should behave as follows:

  • The rules should be printed to the screen
  • The user is asked if they'd like to play a round
    • if they choose 'y', a round is played
    • if they choose 'n', the program ends
  • Until the user has chosen to quit, another round is played.
  • In a round of play:
    • The user is asked to enter a move, which may be either Kvalfjord, Bjorksnas, Hauga, Nordli, or Slakt. The program should continue to prompt the user until a valid move is entered.
    • The computer makes a move at random. (Hint: remember how we generated random numbers in class.)
    • The program prints the computer's move, the user's move, and who is the winner of this round.
    • The user is asked if they'd like to continue.
  • When the user has decided to quit the game, the program prints the number of:
    • rounds played
    • times the user won
    • times the computer won

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

7-2 What are the different types of networks?

Answered: 1 week ago