Giter Site home page Giter Site logo

ai-1's Introduction

Antonio Cesar Vargas
Queens College Fall 2010
Program 2

A* program in order to solve 9 square puzzle problem.

Input:Two 9x9 square of number separated with space. The first one is your goal node, and
the second one is the start node.

Output:You will get a solution to the puzzle including every step that it took
in order to get the goal node.

The following is the A* algorithm.

Create a list called OpenList
Create a list called ClosedList

Create a new state for the initial node and the evaluate f*.

Insert new state s into OpenList

while OpenList is not empty
 current_node <- OpenList.pop();
 ClosedList.push( current_node );
 if ( current_node == goal )
    return current_node;
 else
    children_current_node <- expand(current_node);

 for each child j of current_node
   evaluate f* on each j
    if not member (OpenList) and not member (ClosedList)
      OpenList.insert(j);
      current_node.link(j);
   else
     if f* of j is bettern than f* of j in OpenList
       Replace(OpenList,j);
       current_node.link(j);
     if f* of j is better than f* of j value in ClosedList
     	ClosedList.remove(j);
	OpenList.insert(j);
	current_node.link(j);

ai-1's People

Contributors

chesarin avatar

Stargazers

 avatar

Watchers

 avatar 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.