Create a instance of the class you are writing

Assignment Help JAVA Programming
Reference no: EM131591307

Problem Specification
We are going to implement the game of Gomoku, also known as five-in-a-row.
The game is very similar to tic-tac-toe, only that you are playing on a larger board (usually consisting of a squared paper). The goal is to get five-in-a-row. You are allowed to place your marker anywhere there's an empty square on the board. The two players (X and O) take turns to place their markers on an empty square on the board, and may try to play offensively or defensively. The person with the best strategy and sharpest eyes usually wins the game.

What's included
I've prepared the visualization for you in a class called GomokuGUI. This class has a static method that is passed in an object that has functionality specified as in the "class" GomokuModel. The methods in this class that's really an interface (we'll talk about that in class), are the following:

• intgetNumRows()
intgetNumCols()
intgetNumInLineForWin()

These methods specify the size of the game board and the number of squares in a line needed for a win. To play the default game, just have these methods return the default constants defined in GomokuModel. When testing your code, you may find it easier to experiment with a smaller board. In that case, you can change the values returned by these methods and the GUI should be able to adapt.

1
• Outcome playAtLocation(int row, int col);
This method is called by the GUI whenever a click occurs on the game board. It's supposed to update the state of the game board, and the return value is a value that describes the current state of the game after the newly entered click was applied.
• voidstartNewGame();
This method is called by the GUI whenever a new game is begun. It should set up whatever bookkeeping is needed to start a fresh game.
• String getBoardString();
This method returns a string representation of the board. The GUI calls this method whenever it needs to know what the board looks like in order to be able to redraw it. The string that is returned must match the specific format described in the interface documentation.
• voidsetComputerPlayer(String opponent);
This method configures what sort of computer player (if any) will be used.
Please refer to the documentation for GomokuModel.java for more information.

To do
To get started, create a file called Gomoku.java. It should be a class that implements the model interface. I'll show you in class how to make this happen. However, the main method should look something like this:
public static void main( String[] args ) { Gomoku game = new Gomoku (); if(args.length> 0) {
game.setComputerPlayer(args[0]); }
GomokuGUI.showGUI(game); }

Three things happen in this main method:
1. Create a instance of the class you are writing.
2. Possibly configure the Gomoku object based on a command line argument. (Any command line arguments given to a Java program are available in the String array parameter of the main method.)
3. Pass the Gomoku object to a static method in the GomokuGUI class that will actually get the GUI started.
There are three parts to the assignment. Each part needs to be completed before the next part is attempted.

2

1. Game play - Make the game work to the point that when clicking the game board, every other click yields a ring and a cross. It should not be possible to place content on a field that has already been played. Basically, in order to do this, you'll have to write all the methods. However, for this part of the game, you are not required to create logic to figure out if someone wins - i.e., the playAtLocation method can always return GAME NOT DONE status flag.

2. Win detection - Everything from the minimum required part, but added in the logic to determine who won the game. Also, the player who won the last game should get to go first in the following round.

3. Computer player - Create a rudimentary computerized player. You'll do this by making the playAtLocation method also fill in a value for the player who didn't start. That will now be the computer player. For full credit, this player's strategy must be better than just random placement on the board, and the player should be able to win a game at least if playing against a somewhat stupid human.
The computer player should only be enabled if it was configured via the setComputerPlayer method. (You may assume that this method will not be called in the middle of a game.) An argument of NONE should disable the computer player, while an argument of COMPUTER should enable it. If you want to explore additional computer player strategies, feel free to recognize additional Strings. If you do this, please be sure to document it so that the grader will know to try them.

Attachment:- lab3.jar

Reference no: EM131591307

Questions Cloud

Discuss appropriateness and effectiveness of visual aids : For the Unit 5 assignment, you will write a reflective analysis paper about your presentation-creation process and your Unit 4 live, oral presentation.
Outline the federal guidelines on procedural safeguards : Create a 10-15 slide presentation that includes Outline of federal guidelines on procedural safeguards or rights of special needs' children and families.
Does the subjecttake a vitamin supplement : Does the subjecttake a vitamin supplement? Why or why not? If he/she takes supplements,how much does he/she spend a month on vitamins?
What sentencing model would you attach for violent crimes : Considering the goals of sentencing, what sentencing model would you attach for violent crimes? Property crimes? Drug crimes?
Create a instance of the class you are writing : Create a instance of the class you are writing - Possibly configure the Gomoku object based on a command line argument
What level of measurement applies to your proposed : Create a question or set of questions that operationalize the concept.What level of measurement applies to your proposed measure?
Identify your peers and instructor as the intended audience : Based on the topic and outline from previous Units, you will make a formal live oral presentation to your instructor and peers.
Prepare the adjusting entry to record income tax expense : Please prepare the adjusting entry to record income tax expense, income tax payable, and deferred income taxes
Explain the features-returns of pruguard my family insurance : Explain the features, benefits, risks and returns of Pruguard my family insurance,

Reviews

Write a Review

JAVA Programming Questions & Answers

  Calculate the percentage wins of a team

Write a program that will calculate the percentage wins of a team. The program will input the number of wins and losses that a team acquired during a season. The wins should be input in a parameter-less value returning function that returns the wi..

  Explain the tasks occur in exception handling

Calculate the letter grade the student has earned based on the average of these assignments.

  In light of wrestling with ethics

In light of "Wrestling With Ethics" and other research/articles that you are able to draw upon, should profitability drive social responsibility? Be sure to support your discussion question responses with evidence from the readings and/or additional ..

  Write the method called print triangle type.

Write the method called printTriangleType. This method accepts three integer arguments representing the lengths of the sides of a triangle and prints the type of triangle that these sides form. Here are some sample calls to printTriangleType

  Changing the general tree class template

Here is a client you can use to test your code. I am not going to tell you what this client should produce. You should be able to predict that on your own and m

  Integer expression evaluator

You must implement a bounded generic Stack class. Represent your Stack using an array to hold the stack content - Integer Expression Evaluator

  Write down a java program and pseudocode to read a number

write a java program and pseudocode to read a number up to 15 digits long or a date ddmmyyyy. the program should

  1design an abstract data type in java that represents a

1.design an abstract data type in java that represents a musical pitch noteadt.java. the adt should store the note or

  Write a java program that uses a search tree of strings

Write a Java program that uses a search tree of strings to sort text lines in alphabetic order. You may choose how you de?ne alphabetic order as long as there is some sense in the de?nition. You may also choose what kind of tree you use.

  Implement security so that all users can view the informatio

Implement security so that all users can view the information about the projects, but only authenticated users

  Design and implement a small and simple email server using

design and implement a small and simple email server using the concept of web based information system wbis. your

  Prove that the difference of two odd integers is even

Prove that the difference of two odd integers is even. Give a justification at each step. Prove that the sum of any two rational numbers is a rational number. Give a justification at each step

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