Programming Challenge

(1/1)

**Richard Marks**:

Challenge Level 1 - determine what this algorithm is

Challenge Level 2 - write an implementation of this algorithm

Challenge Level 3 - write a derivative of this algorithm that is faster

Rules:

Rule #1 - Submit your entry/answers to me using a Forum Private Message. Do NOT post your entry or answers to challenges on the forum.

This is so that others have a chance to figure things out if you already have.

Rule #2 - You may write your entry in any language that you feel comfortable with.

Rule #3 - All entries will be checked for plaigarism against more than 2500 public code listings. Any entries that are deemed invalid will be forfeit.

All entries will become the property of CCPS Solutions.

Rewards:

#1 One free month membership for the shortest implementation of the following algorithm.

#2 One hour of free training for a faster derivative.

Code:

BEGIN

CREATE OPEN ARRAY

CREATE CLOSED ARRAY

S.G = 0

S.H = FIND_HEURISTIC(S.X, S.Y)

S.F = S.G + S.H

S.PARENT = NULL

PUSH S INTO OPEN ARRAY

KEEP_SEARCHING = TRUE

WHILE KEEP_SEARCHING

N = POP NODE FROM OPEN

IF N IS GOAL NODE

BUILD PATH FROM START TO FINISH

KEEP_SEARCHING = FALSE

FOR EACH NEIGHBOR M OF N

NEWG = N.G + COST(N, NEWX, NEWY)

IF M HAS NOT BEEN VISITED

M.G = N.F

M.H = FIND_HEURISTIC(NEWX, NEWY)

M.F = M.G + M.H

M.PARENT = N

ADD M TO OPEN ARRAY

SORT OPEN ARRAY

ELSE

IF NEWG < M.G

M.PARENT = N

M.G = NEWG

M.F = M.G + M.H

SORT OPEN ARRAY

IF M IS IN CLOSED ARRAY

REMOVE M FROM CLOSED ARRAY

PUSH N INTO CLOSED ARRAY

IF SEARCH_TIME > MAX_SEARCH_TIME

KEEP_SEARCHING = FALSE

RETURN PATH

END

I offer a single tip: RESEARCH AND EXPERIMENTATION ARE KEY.

Good luck participants. 8)

**WhoNeedszzz**:

I'm game.

**Richard Marks**:

As of now, Kevin Hulin is in the lead, with the right answer to level 1 and an implementation for level 2.

Michael Cusack holds second place with a correct answer for level 1.

Anyone else going to try their hand at this? Hmm?

Navigation

[0] Message Index