Determine the best moves for an abbreviated game

Assignment Help JAVA Programming
Reference no: EM131565573

Project: Connect

In this project you will help determine the best moves for an abbreviated game of Connect4. The program will analyze the best starting position to make a move. Due to processing times our Connect4 board will be 4 x 4, versus the actual 7x7 board of the game.

951_figure.png

The program will explore making its first move in each of the four columns. The first action will be to make a move in one of the four columns. The program will then pass the Board, and the next player to a Play method. The Play method will analyze the board and call itself up to 4 times, representing the possible number of next moves. At times the Play method may call itself less than four times due to the condition that a column is full. The Play method will return a 1 if the game is won by the first player, -1 if won by the second player, and zero, if that moves leads to a tie. Hence Play (board, clr) gives you the Net wins for first player, given the board position represented by board, and the next move is to be taken by clr.
A game is won if 4 discs of the same color appear in a column , row or diagonal.
Objectives
The goal of this programming project is for you to master (or at least get practice on) the following tasks:
• understanding recursion calls
• debugging and checking results
• writingclasses
• working with existingcode

Start early! This project may not seem like much coding, but debugging always takes time. Analyze and plan now so questions are not being asked a day before the due date.

Helpful code:
Code is provided to do the same type of logic as this problem, except with a Tic Tac Toe Board. In the Tic Tac Toe game, after the first move, there are 8 possible moves by the second player. In Connect4, with our abridged board, there are always a maximum of 4 next moves. Also in the Tic Tac Toe game the next move can be anywhere on the Board, while in Connect4, only the bottom of an open column can be chosen for the next move.

Tic Tac Toe Program Logic
The logic of the program provided prints out information for X making the first move in one of the three spaces of a diagonal. In the Main method, within a loop iterating through the 3 diagonal spaces, the program makes a first move and then calls Play , passing the current board state, and next player.
Within Play, the method first checks to see if the current board has a winning position for either player. If so, 1(X) or -1(O) is returned. Also a non-winning full board is checked. If the board is full, with no winner, then zero is returned. The CheckBoard method does this analysis of the board.
If the board is not a complete game, CheckBoard returns 3. This result prompts Play to recursively call itself with all possible moves for the current player. The current board array is copied to another array. to ensure future executions of the method do not alter the current board.

Expected Results:
It is advised to make your Connect4 program also work on a 3 by 3 matrix. This is easier to test with, since the 4x4 does take more processing. If you run a 3x3 Connect4 game , these are the results you should achieve:

NetWins for column 0: 112
Number of recursion calls: 1087
Red Wins:224Blue Wins: 112
******************
NetWins for column 1: 6
Number of recursion calls: 1103
Red Wins:168Blue Wins: 162
******************
NetWins for column 2: 112
Number of recursion calls: 1087
Red Wins:224Blue Wins: 112
******************
Running the program
The zipped java project file, which contains all your source code, input files and Eclipse related projects, is to be submitted. If you submit an incorrect file (say , just the source file) you will lose 10% of the project value. If you are unsure you can submit a non-working early version to be sure. You may include more than one test file to indicate your program is working.
Working on This Assignment
You should start right away!
You should modularize your design so that you can test it regularly. Make sure that at all times you have a working program. You can implement methods that perform one task at a time. This way, if you run out of time, at least parts of your program will be functioning properly.

1. Program shows a recursive approach to determining the next possible positions and making recursive calls.
2. Required outputs, including the number of wins by player, and number of recursion calls.
3. Results are accurate. Show how you can achieve the results for the 3x3 shown in this sheet.

When considering the next possible moves, if the player can win, have that player only make that move. For example, if all four columns have an opening, but moving in column 3 wins the game, only recursively call moving in column 3.

Reference no: EM131565573

Questions Cloud

Building the physician organization : After some years experience with an integrated health system, you apply for a post as executive director of a new moderate-sized physician organization.
Determine the skills strengths or qualities that you possess : Determine the skills, strengths, or qualities that you possess, relative to seven dimensions of Global Leadership and Organizational Behavior Effectiven Model.
Write a program to play a rock-paper-scissors game in java : Write a program to play a rock-paper-scissors game in Java? Two users take turns entering R, P, or S.
Define the need for the idea : Request a commitment. Following up on your presentation may be required to get a definite, timely decision on whether it will be funded.
Determine the best moves for an abbreviated game : determine the best moves for an abbreviated game of Connect4. The program will analyze the best starting position to make a move
Discuss any unofficial code regarding gratuities : Discuss any unofficial code regarding gratuities, Determine from the officer the department's official policy related to gratuities
What type of communication tool would you use : You have an idea to improve patient care that you would like upper management to support and fund.
Explain what is hypothesis testing : What is hypothesis testing? Explain the general process and the steps included in conducting a hypothesis test?
What are the highlights and limitations of theory/principle : What are the highlights and limitations of the theory/principle? What were the signs of the time which led the theorist to develop the management concept?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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