arimbun

Pathfinder 2.0 released

Tags: ,

Pathfinder 2.0 is the latest update to the original Pathfinder, an artificial intelligence bot written in Python which is capable of traveling through a maze between two specific points. Version 2.0 incorporates a graphical user interface (GUI) and the removal of user interaction via the command prompt. This new interactive GUI allows user to:

  1. Resize the maze anywhere from 8×8 to 16×16.
  2. Specify forbidden nodes, start node and end node anywhere within the maze.
  3. Select one of the five available algorithms for use with path searching.
  4. View the resulting path from start to goal on a given maze display window.

Source code may be downloaded from within my GitHub repository. Critics and suggestions welcome.

PHP: echo and print

Tags: , , ,

Both commands are used to display some output, so what’s the difference? I chanced upon an interesting article that covers the differences between the two. I’ll put up the summary here:

  • echo is (marginally) faster than print. Providing that the statement is in a large enough loop, one will notice a slight performance gain by using echo. It’s probably advisable in the long run, unless you’re already used to print.
  • passing mutiple string parameters is faster than concatenating multiple echo calls. See example below:
  • // "." signals concatenation and is slower
    echo "hello" . "world"
    
    // "," signals multiple arguments and is faster
    echo "hello", "world"

The Pathfinder

Tags: ,

Artificial Intelligence (AI) has always been one of my interests. I was lucky enough to enrol in possibly one of the best courses offered at The University of Sydney, namely COMP3308 Introduction to Artificial Intelligence. My first assignment touched on path search algorithms which form the basis of “smart robots”. The problem in a nutshell is to write a program that, given a start node and a finish node, finds a path through a given maze (8×8 or 16×16) in the most efficient way. Five different algorithms were used: breadth-first search, depth-first search, greedy best-first search, A* search and hill-climbing search.

You can download the Python source code and documentation on my GitHub.

I am planning a version 2 which will incorporate a GUI for visual aid of the simulation, but first I’ll need to get my Python GUI programming up to speed…

The Friends problem

Tags: ,

This is a good programming practice of creating a recursive descent parser besides the calculator itself. The Friends problem calculates the set union(s) or set difference(s) between a given number of sets.

Sample input

{ABC}
{ABC}+{DEFG}+{Z}+{}
{ABE}*{ABCD}
{ABCD}-{CZ}
{ABC}+{CDE}*{CEZ}
({ABC}+{CDE})*{CEZ}

Sample output

{ABC}
{ABCDEFGZ}
{AB}
{ABD}
{ABCE}
{CE}

Source code is available on my GitHub.

The Stockbroker Grapevine problem

Tags: , ,

The Stockbroker Grapevine problem involves finding the shortest amount of time to spread rumours to all stockbrokers in a given set of networks. If there exists a stockbroker who cannot be reached in a particular network, the program should warn the user of a disjoint network.

This little exercise requires the use of Dijkstra’s infamous shortest path algorithm. My solution is inspired by that of my university tutor (Enoch Lau) and was coded as a tutorial exercise for the INFO3220 Object Oriented Design in C++.

Source code is available on GitHub.

The Flight Booking System

Tags: ,

Anyone who has done serious software development work will probably have programmed a booking system. This is because of the nature of the system itself—it easily covers fundamental concepts found in software development such as data storage, information retrieval, output formatting and user interaction. The flight booking system that I wrote for SOFT1901 Software Development 1 (Advanced) assignment is one such program. Written in Java on my first semester at Sydney Uni, this program might not be the most efficient in terms of performance, but feel free to have a look if you want to grasp the common practices of software development.

Source code and documentation are available on GitHub.

Facebook algorithmic puzzles

Tags: , ,

If one delves hard enough into Facebook, one may find a page containing some of the most demanding puzzles in computer science. Note that it is advertised as Engineering Puzzles, but I feel that it’s more of a computer science nature since it requires the solutions to be coded in programming languages.

© 2010 arimbun

Powered by Wordpress and Magatheme