Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Purpose: There is a famous puzzle called the 15-puzzle (feel free to look it up on the internet - eg en.wikipedia.org/wiki/15 puzzle). In this puzzle there is a frame that could hold 16 tiles in a 4x4 configuration, but the frame contains only 15 tiles where each tile is labeled with a number between 1 and 15. Since one of the locations is empty, it is possible to slide another tile (from above/below/right/left of the empty location) into this location. The goal of the puzzle is to reach the point where the numbers are organized so that they read (top to bottom, left to right) 1, 2, 3,..., 15, space. The diagram below shows a very simple example with the final solution on the right.

2448_puzzel.png

You will be writing a Java program to allow people to play the 24-puzzle (the obvious variant where the frame is 5x5) puzzle) in a text based context. My goal is that you recall how to enter programs (probably using jGrasp), how to write a small/simple program, how to compile and debug your work, and learn how to submit your work via moodle. This is meant to be a review project.

Requirements: To complete this project you will write two classes and one text file.

Create a file called Board.java which will be the "guts" of the project. This class will likely contain a field int[][] theFrame (a 5x5 integer array), a method readInitialBoard(String fileName), a method makeMove(int number), a method showBoard(), and a method isCorrect(). Each method does exactly what a reasonable person would expect. You are welcome to have other fields and methods

Create a file called Driver1.java which will interact with the user and "run" your program. There is a sample interaction below. You should have your program match the style/sytax as closely as possible. Due to class size, some of the grading of projects gets automated which means deciding to go with a di↵erent format for input or output will likely result in losing points even if you think "my way is just as good as his". Typically, this class would create an instance of Board.java, fill the board with the information from the file input.txt (a sample is below: 0 indicates the empty position). Then it would repeatedly ask the user for a command and perform that command. Legal commands would include: help, quit, and move. It ends if the user quits or the problem is solved.

Create a file called status.txt which contains your name and a short (2-10 sentence) description of the status of your program. This file should be an ascii file. Though you may create it with MS Word (or notepad/wordpad/jGrasp/etc), you should be certain that it is a text file.

Java, Programming

  • Category:- Java
  • Reference No.:- M91374564
  • Price:- $45

Guranteed 36 Hours Delivery, In Price:- $45

Have any Question?


Related Questions in Java

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As