This website uses cookies to ensure you have the best experience. Learn more

N Puzzle Problem In Java, Lisp & Prolog

4367 words - 17 pages

ABSTRACTThe well known N-puzzle problem consists of a square board containing N square tiles and an empty position called the "blank". Authorized operations like up, down, left and right slide any tile adjacent to the blank into the blank position. The task is to rearrange the tiles from some random initial configuration into a particular designed goal configuration. A* search is used to solve the N-puzzle in this paper. This application has been implemented in three different kinds of programming languages which are the Object-oriented, functional and logic programming languages. Java(JDK1.3.1), Lisp(Corman Lisp 2.0) and Prolog(SWI-Prolog version 5.0.9) are the versions of each of the chosen languages. A brief introduction of each programming language is given. The structure of this paper is as follows. A short introduction for each of the chosen programming language. Then an explanation is given on a few of the main variables used in the programs. This is followed by the advantages and disadvantages of using the chosen languages for the application. And finally, a short conclusion to wrap the paper up.1. INTRODUCTION1.1 The N-Puzzle ProblemThe well known N-puzzle problem consists of a square board containing N square tiles and an empty position called the "blank". Authorized operations like up, down, left and right slide any tile adjacent to the blank into the blank position. The task is to rearrange the tiles from some random initial configuration into a particular designed goal configuration. A* search is used to solve the N-puzzle in this paper. A* search is optimal. So, we can find the smallest number of steps from the initial state to the goal state.Evaluation function, f(n) = g(n) + h(n)g(n) = cost so far to reach nh(n) = estimated cost from n to goal= number of misplaced tilesf(n) = estimated total cost of path through n to goal1.2 Programming Languages1.2.1 JavaAs described by Sun, Java is "a simple, objected oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded, and dynamic language".Java, formerly known as oak, is an object-oriented programming language developed by Sun. It shares many superficial similarities with C, C++, and Objective C. The language was originally created because C++ proved inadequate for certain tasks. Since the designers were not burdened with compatibility with existing languages, they were able to learn from the experience and mistakes of previous object-oriented languages. They added a few things C++ doesn't have like garbage collection and multithreading; and they threw away C++ features that had proven to be better in theory than in practice like multiple inheritance and operator overloading.Even more importantly Java was designed from the ground up to allow for secure execution of code across a network, even when the source of that code was untrusted and possibly malicious. This required the elimination of more features of C and C++. Most notably...

Find Another Essay On NPuzzle Problem In Java, Lisp & Prolog

Career of a Computer Programmer Essay

593 words - 2 pages language such as COBOL, Prolog, Java, C++, and Smalltalk depending on the purpose of the program. COBOL is used for business applications when C++ is used for scientific and business programs. Most programmers know more than one language and because most of the languages do not have that many differences between them they are not terribly hard for the programmer to learn. After the Program is finished they use a process of testing and debugging

Java Essay

1411 words - 6 pages built into next-generation telephones, TV set-top boxes, smart cards that fit in your wallet, and many other consumer and business devices. Perhaps the most visible examples of Java technology-based software today are on the Internet and on enterprise networks. They're nimble, interactive programs called "applets." As in the example on the right, applets work inside Web browsers on computers and other devices. And there are other kinds of Java

TypeScript, an Answer to JavaScript’s Perceived Flaws?

600 words - 3 pages of Java Script’s ostensible flaws. In spite of all these added features, developers still stick with plain old java script arguing they aren’t interested in the so called new features or isn’t solving a problem they are experiencing or it’s just Microsoft’s idea to meet their internal needs. What’s your take? At Stylus ( we may look into using the TypeScript in our next project that has a large Java Script code base.

A Framework for Parallel Code Execution using Java

3795 words - 15 pages major problem in parallelizing software is that the existing tools and libraries to write a parallel program are complex and difficult to use. This paper presents a Java based framework for parallel code execution. Java has been chosen to make this framework because today, it is being considered the most popular language for writing platform independent applications [28]. The proposed framework is written in pure Java and does not incorporate

Functional Data Structures in Common Lisp:

2132 words - 9 pages Functional Data Structures in Common Lisp: A Google Summer of Code Proposal Andrew Baine March 26, 2007 1 Functional Programming Functional programming is a programming paradigm based on composing, ap- plying, and evaluating functions. Advantages of functional programs include the ease of reasoning about their behavior, the simplicity of parallel execution, and the availability of efficiencies such as lazy evaluation

What is Artificial Intelligence?

2599 words - 10 pages Simon developed a program called 'The Logic Theorist' which was considered to be the first AI program. Representing each problem as a tree model, the program would attempt to solve it by selecting the branch that would most likely result in the correct answer. This would require some knowledge of the area to which the problem refers but the program would do the rest. The impact that this program made on the public and AI community has made it a

Medical Diagnostic Expert System

1244 words - 5 pages PROBLEM DEFINITION RESEARCH PROBLEM - Importance of medical expert systems in the medical field. Medical experts are not always available in a timely fashion, i.e. when they are needed most. RESEARCH QUESTION- How do medical expert diagnostic systems help doctors and patients? HYPOTHESIS - Medical diagnostic expert systems aid doctors and patients to diagnose illness and recommend medication. There is an alarming shortage of medical

Champion Services, Inc. - Software Development Proposal

1641 words - 7 pages disadvantages. One advantage to using MySQL is that MySQL has cross-platform capabilities. Another advantage to MySQL is that MySQL is open-source. MySQL also has some disadvantages. The main disadvantage to using MySQL is that it lacks some of the high-end features found in Oracle and other database management systems. "Java is a portable object-oriented language developed by Sun Microsystems. Originally used mostly for web programming, it is

Python Versus C

1295 words - 5 pages checking than C/C++, and being a high-level language, it has high level data types built in, such as flexible arrays and dictionaries that would cost you a lot of time to implement efficiently in C/C++. Python uses general data types, which is applicable to a large problem domain. General data types makes Python code very simple to read and use. C/C++ on the other hand, uses a standardized version to reference data types, which can be difficult to

A Cognitive Model of New Data on Human Problem Solving

2211 words - 9 pages the project during the 2001-2002 academic year. September-October 2001: Prolog Translation & Prototype One Problem During this month I will begin the translation from physics problems to probability problems. I will use the results of the task analysis during this phase in making this transition. I will also prototype one of the example problems concurrently. November-December 2001: Protocol Encoding & Code Problem Sets First I do a full

Machine Learning

2808 words - 11 pages neural networks: The unrealistic expectations and computational limitation. On the other hand, with the PROLOG and LISP computer language decision-support products (expert systems) became viable (Waterman and Hayes-Roth 1978; Giarratano and Riley 1998). With the help of back-propagation of errors and ensuing multilayer perceptrons (Rumelhart, Hinton, and Williams 1986 research on artificial neural networks was revived.Classification and

Similar Essays

Compiler Essay

4117 words - 16 pages interpreter in Java. JVProlog -- implementation of Prolog based on special abstract machine. Linux Poplog -- developing Common Lisp, Prolog, Pop-11 and standard ML. LLP -- a logic programming language based on intuitionistic linear logic. Lolli -- a logic programming language based on a fragment of linear logic. Lygon -- Prolog extended with features derived from linear logic. PM -- a compiler for the logic programming language

Prolog Essay

754 words - 3 pages What is prolog? Prolog is a descriptive language because a program describes the problem rather than the steps taken to solve the problem. This allows the program to concentrate on the problem rather than the machine’s solution to the problem. The description of a problem also describes the procedures for solving the problem. Prolog is also a procedural language, when you describe the relationship between objects, you can also define an

Being Popular Essay

7204 words - 29 pages reason Lisp isn't currently popular. Common Lisp has worse problems than unfamiliar syntax. I know several programmers who are comfortable with prefix syntax and yet use Perl by default, because it has powerful string libraries and can talk to the os.There are two possible problems with prefix notation: that it is unfamiliar to programmers, and that it is not dense enough. The conventional wisdom in the Lisp world is that the first problem is

Java Vs. C++ Essay

1135 words - 5 pages computer programming arena, Java and C++, this paper will examine the similarities and differences between these new languages.Both Java and C++ are object oriented programming languages, but what does that mean? Object oriented programming (OOP) emphasizes data, instead of algorithms for solving problems. Instead of trying to fit a problem to the procedural approach of a language, OOP attempts to fit the language to the problem, in other words, OOP is