Code Monkey home page Code Monkey logo

sokoban-solver's Introduction

sokoban-solver

COMS W4701 Artificial Intelligence
Fall 2013
Assignment 2: Sokoban Search Algorithm
James Hyun Seung Hong (hh2473)

Purpose

The purpose of this project is to solve a Sokoban puzzle using different search methods.

More information on Sokoban puzzle: http://www.sokobano.de/wiki/index.php?title=Main_Page

Implementation

Search methods that I have implemented are:


For greedy and A* search algorithms, I used 4 different heuristic functions: - Manhattan distance (http://en.wikipedia.org/wiki/Taxicab_geometry) - Euclidean distance (http://en.wikipedia.org/wiki/Euclidean_distance) - Hungarian algorithm (http://en.wikipedia.org/wiki/Hungarian_algorithm) - Max{manhattan, euclidean, hungarian}

Hungarian algorithm is adapted from https://github.com/KevinStern/software-and-algorithms/blob/master/src/main/java/blogspot/software_and_algorithms/stern_library/optimization/HungarianAlgorithm.java

Instructions

.java files should be placed in same directory as img folder and examples folder for the program to locate the images properly.

Usage

To compile files:

cd src
javac *.java

To run the program:

java SokobanTester

Input

The Sokoban files must be in the following format:

[Number of columns]
[Number of rows]
[Rest of the puzzle]

Puzzle should be expressed using the following ASCII characters:

#   (hash)      Wall 
.	(period)	Empty goal 
@	(at)    	Player on floor 
+	(plus)		Player on goal 
$	(dollar)	Box on floor 
*	(asterisk)	Box on goal 

Output

The output is in the following format:

1. Search method used to solve the problem
2. Move solution (or fail message if no solution found)
3. Total number of steps taken
4. Number of nodes generated
5. Number of nodes containing states that were generated previously
6. Number of nodes on the explored list (if there is one) when termination occurs
7. The actual run time of the algorithm, expressed in milliseconds

The output is also printed out in the "Answer" section of the GUI frame.

Screenshots

Initial screen when the program starts. Select the search method from the left to start. Initial screen

Select the search method and enter the file path with filename. If necessary, choose the heuristic method (only for greedy and A*). Selecting search method

When a user presses start, the output is printed in the "Answer" section of the GUI frame, which prints the solution steps and the puzzle. A step-by-step solution to the puzzle can be shown by pressing "Previous" or "Next" button. Showing solution

sokoban-solver's People

Contributors

jameshong92 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.