Design an interface interactive game

Assignment Help JAVA Programming
Reference no: EM13810057

Problem Statement

First, design an interface InteractiveGame that generalizes the playing of any two-person game between a human player and the computer. Design two actual games, Nim and another game of your choice, except TicTacToe, that implement your InteractiveGame interface.

Requirements

1. Write an implementation of this Nim version to implement your InteractiveGame interface. Nim should have the following 4 instance variables only:

private int pileSize; //The number of marbles currently in the pile

private boolean playSmart; //true iff the computer plays smart

private boolean playersTurn; //true iff it is the player's turn to move

private String gameRecord //Complete history of the game's progression

• The Nim constructor should generate a random number (10 ... 100) for the initial pile size.

• Instance variable, gameRecord, must be updated on every move to provide a clear complete record of the progress of the game.

• Implement the textbook strategy for playing smart.

2. Write another 2-person game to implement your InteractiveGame interface.

3. In both Nim and your game, the prompt for a player's move must include a clear representation of the current state of the game; the prompt must show sufficient information to allow the player to decide on their next move. The player prompts must be implemented using JOptionPane methods. Assume that the human player is unfamiliar with the game being played.

Reference no: EM13810057

Questions Cloud

Leaving but for a different product line : Russell Smith - design specialist. Russell is in the same role as the person leaving but for a different product line. Russell is new to the company; however, he has been involved in creating a similar product at a prior company but in a more juni..
Program that allows the user to make some ledger transaction : Write a C program that allows the user to make some ledger transactions. The program should first prompt the user to enter the current balance of his/her ledger account (must allow for dollars and cents, and not less than zero)
Determine the required value of h : Determine the required value of H to eliminate the effect of the disturbance.
Challenges of ensuring all business : You are to prepare a business report that addresses the challenges of ensuring all business units in the supply chain have the right amount of the right product in the right place at the right time and at the right cost.
Design an interface interactive game : First, design an interface InteractiveGame that generalizes the playing of any two-person game between a human player and the computer. Design two actual games, Nim and another game of your choice, except TicTacToe, that implement your Interactive..
Principles of finance : Principles of Finance
Compute critical aspect ratio : Compute E(trans), G12, and compare with E(trans) by isostress model - Compute vc(long) and vc(trans).
Generate an array of random integers from zero to nine : Generate an array of 20 random integers from zero to nine. Search for the first occurrence, if any, of the number 7, and report its position in the array
What are the functions of proteins in the body : What are the functions of proteins in the body

Reviews

Write a Review

JAVA Programming Questions & Answers

  A jsp expression can contain any java expression

A JSP expression can contain any Java expression that evaluates to a

  Practice using recursion with data structures

Write a recursive method in this class called hasSameStructureAs(BinaryTree tree) that returns whether or not a tree has the same structure as another tree.

  Splits the word into a unicode character array

Write methods that take a word input by the user and then- splits the word into a unicode character array. determines if the input word is a palindrome - the same frontwards and backwards.

  Write a java program to read sequences of integers from a

write a java program to read sequences of integers from a text file build a binary search tree for each sequence by

  Advantages and disadvantages of a stringbuilder

What is the difference between string and StringBuilder? What are the advantages and disadvantages of a StringBuilder

  Write a program counter.java that is a thread

Write a program Counter.java that is a Thread that counts up to a limit with random pauses in between each count.

  How array is declared and initialized in java

What is a Java applet - how array is declared and initialized in Java and what are the access control attributes in Java?

  Create java applet to represent grade of gas

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Java program to read line of text which ends with period

Write down the java program which will read the line of text which ends with the period, which serves as sentinel value. Show all the letters which occur in the text.

  Create a class called employee

Create a class called Employee that has the following attributes: Employee ID of type String, First name of type String, Last name of type String

  Write a java program that draws a square abcd

Write a java program that draws a square ABCD. The points A and B are arbitrarily specified by the user by clicking the mouse button. The orientation of the points should be counter-clockwise

  Create a user interface for a library application

Create a user interface for a library application that allows the user (i.e., the Librarian) to enter Book objects.

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