Jump to content
BrainDen.com - Brain Teasers
  • 0


Guest
 Share

Question

hello everyone, and welcome to the amazing contest. your task, should you choose to accept it, is to write a program that generates a maze, and a second program that traverses a maze.

the maze will be size 50 by 50 cells. each cell will either be blank (can move through) or X (cannot move through)

every maze should have two openings along the outer wall (the outer wall counts toward the 50 by 50, so really it's more 48 by 48) and a path that goes from one to the other.

the score you receive is as follows: the average time (in seconds) it takes someone to traverse your maze/the average time it takes you to traverse someone else's maze.

you can have just one long winding path, or many paths with dead ends, a single static maze, or a more randomly generated one, its up to you!

I'll be coding the contest in python, though java is fine for submission.

Link to comment
Share on other sites

Recommended Posts

  • 0

cool!

I have lots of questions:

(1) how do you want the output of our maze-generators to be? A two-dimensional array of booleans or something?

(2) (related to #1) what will the input be for our maze-navigators? we get to see the whole thing beforehand before "charting a course", right?

(3) how exactly will the maze-traversing environment be run? what is "1 second"? (eg is it a second in real life based on your computer speed or is it a theoretical amount of time for the maze-navigator to move "1 space"), can we move diagonally or just orthogonally?

(4) how will the scoring be exactly? You said "the average time (in seconds) it takes someone to traverse your maze/the average time it takes you to traverse someone else's maze." Does that slash refer to division? And who is "someone"? What if there is more than one opponent? Would be it like this:

Maze X, Maze Y, Maze Z

Navigator X, Navigator Y, Navigator Z

X's score = (time takes Nav Y to get through Maze X + time takes Nav Z to get through Maze X) all divided by (time takes Nav X to get through Maze Y + time takes Nav X to get through Maze Z)

or something along those lines?

Link to comment
Share on other sites

  • 0

the input for the traversers will be an array of strings of length 50, each string 50 characters long. each character will either be a space ' ' or an X, 'X'.

this is what every maze is expected to output.

only orthogonal moves are allowed for the traversers.

yes the slash is division.

let's say we have four people in the contest.

A,B,C,D.

if B,C, and D take 3.5 sec, 2 sec, and 1.4 sec to go through A's maze, then the average would be (3.5+2+1.4)/3 = 2.3

if A goes though B,C and D maze in 2 sec, 6 sec, an .5 sec, then the average would be (2+6+.5)/3 = 2.83.

A's score would be 0.822

the time will be based on run time of the code.

Link to comment
Share on other sites

  • 0

the input for the traversers will be an array of strings of length 50, each string 50 characters long. each character will either be a space ' ' or an X, 'X'.

this is what every maze is expected to output.

only orthogonal moves are allowed for the traversers.

yes the slash is division.

let's say we have four people in the contest.

A,B,C,D.

if B,C, and D take 3.5 sec, 2 sec, and 1.4 sec to go through A's maze, then the average would be (3.5+2+1.4)/3 = 2.3

if A goes though B,C and D maze in 2 sec, 6 sec, an .5 sec, then the average would be (2+6+.5)/3 = 2.83.

A's score would be 0.822

I see (though there's no need to divide by 3 because that divides out but either way it works). And regarding the array of strings, will index 0 be the top row, the bottom row, the left column or the right column? (then i assume 1-49 will follow from there toward the opposite side of the square)

the time will be based on run time of the code.

I don't think this is a good idea. How sensitive does your computer go? Can it measure by the milliseconds accurately (often given in 1000s of nanoseconds instead of in milliseconds)? Even so, this is not accurate at all. Something that interests me is optimizing functions and it's really quite variable. It depends on the circumstances and also some IDEs/compilers have some memory-managing optimizations that let them improve with time. Other things that are open and even the current battery power of your computer (if you use a laptop) can affect the timing.

Another reason this could be a bad idea is because I, and probably many others, are not familar with python (though a few weeks ago I downloaded it, I haven't gotten to it yet) and so we may write our programs in java/c/etc, but when you convert our programs into python, the speed will depend on your optimization of our code. Even if you translate it so that the operations are the same, we may do it a different way because, say, C++ is more efficient at it one way, whereas we may not know that Python in fact is more efficient another way.

You don't have to change it, I'm just pointing out some of the problems with using runtime seconds. Switching to using the number of moves taken instead of the number of seconds has the effect that, although it gives a better picture of how well the navigator algorithm can find the solution, it makes that aspect less important and the maze generator more important. So it depends what you want

Link to comment
Share on other sites

  • 0

okay, yeah, python is okay for runtime, it has a specific library for timing code, never the less, I would need some way to verify that you actually traversed the maze, such as a coordinate list of places visited, so let's go with distance traveled instead. my concern with doing that was if someone does make one long winding path, distance traveled obviously isn't going to be longer than that, unless you want to somehow count backtracking.

Link to comment
Share on other sites

  • 0

Hm, if the navigators have the entire map of the maze they need to navigate, then it would be fairly straightforward to find the shortest possible route through the maze.

Start with a 50x50 array of the maze. The walls are all "X" and the passageways are all blank. Place the number zero on the starting square. Then, place the number one on any open square adjacent to the square with zero. Then place the number two on any open square adjacent to a square with a one (unless the square already has a number in it). Keep repeating until you've filled the maze. Then every square will be filled with a number indicating the minimum number of moves it takes to reach it. Now, start at the exit with number "N", backtrack to any adjacent square with "N-1", then to any adjacent square with "N-2", etc until you reach the starting square.

It might be more tricky if the navigator only gets a map of, say, the 7x7 grid of squares closest to its current position.

It might also be more tricky if the starting and ending points don't need to be at the edge of the maze, and can be somewhere in the middle (as if you're being dropped into the maze and need to find a target inside it). That would prevent you from being sure that you will eventually reach the exit by sticking to a wall.

Link to comment
Share on other sites

  • 0

you have the input of the entire maze, so technically you have the start and end points.

note that a tricky maze designer may create more then 2 openings (one may be false.)

you can start at any open point along the boarder, and if you reach a second open point along the boarder you are done.

I am obviously relying on a degree of honesty here for the traversers. if you scan the whole maze for all traversable spots, then you've essentially traversed the whole maze. if your algorithm has backtracking in it, then you should indicate that in some way that you "visited" that location more than once.

Link to comment
Share on other sites

  • 0

to put it another way:

you have a maze of ' ' and 'X'. you can scan any square. if it is X, no movement cost is applied. however, if it is ' ', one movement cost is added. your output should be a valid path from one opening to another, along with total movement cost.

Link to comment
Share on other sites

  • 0

okay so, think i have everything ready to go.

import random

import sys

class Player:

    def __init__(self):

        #intializes the variables.

        #this allows for any extra storage you need for your maze traverser.

        self.storage = [] 

        #the current coordinate you are at.

        self.coor = [0,0]

        #the coordinate of the goal.

        self.goal = [0,0]

        #the available directions to travel.

        self.left = False

        self.right = False

        self.forward = False

        self.back = False

        #the compass direction you are facing.

        self.direction = "south"

        #number of times your function is called.

        self.turns = 0

        #name you want to call your program.

        self.name = ""

        #your final score.

        self.score = 0

    def MazeGen(self):

        pass   

    def Traverser(self):

        pass


class MazeChecker:

    def __init__(self):

        self.storage = [] 

        self.coor = [0,0]

        self.goal = [0,0]

        self.north = False

        self.south = False

        self.east = False

        self.west = False

        self.direction = "south"

        self.turns = 0

    def PathFinder(self):

        #simply uses the left hand rule untill it finds a way out.

        if self.turns > 50*50*10:

            #no maze should take more than 2*50*50 turns.

            return "no path found"

        if self.coor[0] == self.goal[0] and self.coor[1] == self.goal[1]:

            return "done!"

        #first four if's: turn left if possible.

        if self.direction == "south" and self.east: 

            self.direction = "east"

            self.coor[1] += 1

            return "east"

        if self.direction == "north" and self.west: 

            self.direction = "west"

            self.coor[1] -= 1

            return "west"

        if self.direction == "east" and self.north: 

            self.direction = "north"

            self.coor[0] -= 1

            return "north"

        if self.direction == "west" and self.south: 

            self.direction = "south"

            self.coor[0] += 1

            return "south"

        #next four if's: go forward if possible.

        if self.direction == "south" and self.south: 

            self.coor[0] += 1

            return "south"

        if self.direction == "north" and self.north: 

            self.coor[0] -= 1

            return "north"

        if self.direction == "east" and self.east: 

            self.coor[1] += 1

            return "east"

        if self.direction == "west" and self.west: 

            self.coor[1] -= 1

            return "west"

        #next four if's: turn right if possible.

        if self.direction == "south" and self.west: 

            self.direction = "west"

            self.coor[1] += 1

            return "west"

        if self.direction == "north" and self.east: 

            self.direction = "east"

            self.coor[1] -= 1

            return "east"

        if self.direction == "east" and self.south: 

            self.direction = "south"

            self.coor[0] += 1

            return "south"

        #final four if's: go back.

        if self.direction == "west" and self.north: 

            self.direction = "north"

            self.coor[0] -= 1

            return "north"

        if self.direction == "south" and self.north: 

            self.direction = "north"

            self.coor[0] -= 1

            return "east"

        if self.direction == "north" and self.south: 

            self.direction = "south"

            self.coor[0] += 1

            return "west"

        if self.direction == "east" and self.west: 

            self.direction = "west"

            self.coor[1] -= 1

            return "west"

        if self.direction == "west" and self.east: 

            self.direction = "east"

            self.coor[1] += 1

            return "east"

        #sanity check

        return "Stay"

    def boarderCheck(self,Maze):

        #makes sure there are only 2 openings along the boarder.

        count = 0

        for i in range(0,50):

            #check the top row

            if Maze[0][i] == True:

                if count == 0:

                    count = 1

                    self.coor[0] = 0

                    self.coor[1] = i

                    self.direction = "south"

                    self.east = False

                    self.west = False

                    self.south = Maze[1][i]

                    self.north = False

                elif count == 1:

                    self.goal[0] = 0

                    self.goal[1] = i

                else:

                    return "error: more than 1 goal."

                count += 1

            #check the left column

            if Maze[i][0] == True:

                if count == 0:

                    self.coor[0] = i

                    self.coor[1] = 0

                    self.direction = "east"

                    self.north = False

                    self.south = False

                    self.east = Maze[i][1]

                    self.west = False

                elif count == 1:

                    self.goal[0] = i

                    self.goal[1] = 0

                else:

                    return "error: more than 1 goal."

                count += 1

            #check the right column

            if Maze[i][49] == True:

                if count == 0:

                    self.coor[0] = i

                    self.coor[1] = 49

                    self.direction = "north"

                    self.east = False

                    self.west = False

                    self.north = Maze[i][48]

                    self.south = False

                elif count == 1:

                    self.goal[0] = i

                    self.goal[1] = 49

                else:

                    return "error: more than 1 goal."

                count += 1

            #check the bottom row.

            if Maze[49][i] == True:

                if count == 0:

                    self.coor[0] = 49

                    self.coor[1] = i

                    self.direction = "west"

                    self.north = False

                    self.south = False

                    self.forward = Maze[48][i]

                    self.east = False

                elif count == 1:

                    self.goal[0] = 49

                    self.goal[1] = i

                else:

                    return "error: more than 1 goal."

                count += 1

        if count <2:

            return "error: not enough goals"

        else:

            return True

    def printMaze(self,Maze):

        #print out the maze.

        for i in range(0,50):

            for j in range(0,50):

                if Maze[i][j]:

                    sys.stdout.write(' ')

                else:

                    sys.stdout.write('X')

            sys.stdout.write('\n')


if __name__ == "__main__":

    check = MazeChecker()

    okay = True

    tournament = [Player()]*10

    tournament[0].name = " "

    tournament[1].name = " "

    tournament[2].name = " "

    mazeArray = [0]*10

    for i in range(0,len(tournament)):

        mazeArray[i] = tournament[i].MazeGen()

        okay = check.boarderCheck(mazeArray[i])

        if okay != True:

            print okay

        while okay:

            went = check.pathFinder()

        check.turns += 1

        check.east = mazeArray[i][check.coor[0]+1][check.coor[1]]

        check.west = mazeArray[i][check.coor[0]-1][check.coor[1]]

        check.north = mazeArray[i][check.coor[0]][check.coor[1]-1]

        check.south = mazeArray[i][check.coor[0]][check.coor[1]+1]

        if went == "Stay":

            okay = False

        if not okay:

            check.printMaze(mazeArray[i])

        check.turns = 0

    for i in range(0,len(tournament)):

        for j in range(0,len(tournament)):

            if j != i:

		okay= check.boarderCheck(mazeArray[i])

                tournament[i].goal = check.goal

		tournament[i].coor = check.coor

		tournament[i].north = check.north

		tournament[i].south = check.south

		tournament[i].east = check.east

		tournament[i].west = check.west

		tournament[i].direction = check.direction

                while okay:

                    went = tournament[i].Traverser()

		    if went == "done!":

                        break				

		    if went == "stay":

		        check.coor = tournament[i].coor

		    elif went == "north":

		        check.coor[0] += 1

		    elif went == "south":

		        check.coor[0] -= 1

		    elif went == "east":

		        check.coor[1] += 1

		    elif went == "west":

		        check.coor[1] -= 1

		    if went != "stay":

		        tournament[i].direction = went

		    tournament[i].north = mazeArray[i][check.coor[0]+1][check.coor[1]]

	            tournament[i].south = mazeArray[i][check.coor[0]-1][check.coor[1]]

                    tournament[i].east = mazeArray[i][check.coor[0]][check.coor[1]+1]

                    tournament[i].west = mazeArray[i][check.coor[0]][check.coor[1]-1]

                    tournament[j].score += 1

		    tournament[i].turns += 1

		okay= check.boarderCheck(mazeArray[j])

                tournament[j].goal = check.goal

		tournament[j].coor = check.coor

		tournament[j].north = check.north

		tournament[j].south = check.south

		tournament[j].east = check.east

		tournament[j].west = check.west

		tournament[j].direction = check.direction

                while okay:

                    went = tournament[j].Traverser()

		    if went == "done!":

                        break				

		    if went == "stay":

		        check.coor = tournament[i].coor

		    elif went == "north":

		        check.coor[0] += 1

		    elif went == "south":

		        check.coor[0] -= 1

		    elif went == "east":

		        check.coor[1] += 1

		    elif went == "west":

		        check.coor[1] -= 1

		    if went != "stay":

		        tournament[j].direction = went

		    tournament[j].north = mazeArray[j][check.coor[0]+1][check.coor[1]]

         	    tournament[j].south = mazeArray[j][check.coor[0]-1][check.coor[1]]

                    tournament[j].east = mazeArray[j][check.coor[0]][check.coor[1]+1]

                    tournament[j].west = mazeArray[j][check.coor[0]][check.coor[1]-1]

                    tournament[i].score += 1

		    tournament[j].turns += 1

	for i in range(0,len(tournament)):

	    print tournament[i].name

            print tournament[i].score/tournament[i].turns

            print

so here's the final rules:

only two openings along the boarder.

you will not be given the whole maze, but have the ability to store what you've traversed so far.

you will be given the start and end locations, they can be anywhere along the boarder though.

all you will be given is whether the four directions around your current location are moveable to.

each maze should generate a series of true/false.

(true being can move to, false being not.)

your score will be the total number of moves everyone took on your maze/total you took on everyone else's maze.

i am expecting a series of returns; north, south, east, west, stay, or done!. only one of these per function call. i haven't actually tested my code on any mazes yet, so i still need to debug it, but the logic seems sound. any questions?

Edited by phillip1882
Link to comment
Share on other sites

  • 0

I missed this thread until it got bumped, but I think that there are some problems with your main loop. I'm not completely familiar with Python syntax and all, so I may be misinterpreting some of your logic, but I think that you can clean up the loop and fix a bug or two. It would also help to comment that section better; the earlier parts were nicely commented, but the main loop is rather bare in that regard... :o


    for i in range(0,len(tournament)):

        for j in range(i+1,len(tournament)): #changed 0 to i+1 to remove the necessity of if j != i:

            curMaze = mazeArray[j] #changed i to j since otherwise, I think everyone is testing their own maze

            #also, making it its own variable to reduce copying error

            curPlayer = tournament[i] #doing same with player, may not work depending on how python copies member variables

            okay= check.boarderCheck(curMaze)

            curPlayer.goal = check.goal

            curPlayer.coor = check.coor

            curPlayer.north = check.north

            curPlayer.south = check.south

            curPlayer.east = check.east

            curPlayer.west = check.west

            curPlayer.direction = check.direction

            while okay:

                went = curPlayer.Traverser()

                if went == "done!":

                    break                           

                if went == "stay":

                    check.coor = curPlayer.coor

                elif went == "north":

                    check.coor[0] += 1

                elif went == "south":

                    check.coor[0] -= 1

                elif went == "east":

                    check.coor[1] += 1

                elif went == "west":

                    check.coor[1] -= 1

                if went != "stay":

                    curPlayer.direction = went

                curPlayer.north = curMaze[check.coor[0]+1][check.coor[1]]

                curPlayer.south = curMaze[check.coor[0]-1][check.coor[1]]

                curPlayer.east = curMaze[check.coor[0]][check.coor[1]+1]

                curPlayer.west = curMaze[check.coor[0]][check.coor[1]-1]

                curPlayer.score += 1

                curPlayer.turns += 1

            tournament[i] = curPlayer #Not sure if this works...depends on how python copies members

            curMaze = mazeArray[i]

            curPlayer = tournament[j]

            okay= check.boarderCheck(curMaze)

            curPlayer.goal = check.goal

            curPlayer.coor = check.coor

            curPlayer.north = check.north

            curPlayer.south = check.south

            curPlayer.east = check.east

            curPlayer.west = check.west

            curPlayer.direction = check.direction

            while okay:

                went = curPlayer.Traverser()

                if went == "done!":

                    break                           

                if went == "stay":

                    check.coor = curPlayer.coor #this said tournament[i], almost certainly a bug!

                elif went == "north":

                    check.coor[0] += 1

                elif went == "south":

                    check.coor[0] -= 1

                elif went == "east":

                    check.coor[1] += 1

                elif went == "west":

                    check.coor[1] -= 1

                if went != "stay":

                    tournament[j].direction = went

                curPlayer.north = curMaze[check.coor[0]+1][check.coor[1]]

                curPlayer.south = curMaze[check.coor[0]-1][check.coor[1]]

                curPlayer.east = curMaze[check.coor[0]][check.coor[1]+1]

                curPlayer.west = curMaze[check.coor[0]][check.coor[1]-1]

                curPlayer.score += 1 #same here regarding tournament[i]...

                curPlayer.turns += 1

            tournament[j] = curPlayer
If Python doesn't allow memberwise copy,* then I've noted the points that I think need to be fixed in the second half of the loop where you used i when I think you meant to use j. Also, I think that the tournament should be matched with mazeArray[j] and vice versa, but I could be wrong on that point. Let me know if there's anything wrong with my reasoning. I'm looking into building a player for this, but it'll be a little while and it will be in Java since I have a much better grasp of that than Python (my knowledge of which currently extends to reading your code... :P ). *by memberwise copy, I mean the following:


class Point:

    def __init__(self):

        self.x = 0

        self.y = 0


if __name__ == "__main__":

    pt1 = Point()

    pt1.x = 3

    pt1.y = 4

    pt2 = Point()

    pt2 = pt1

    #pt2 should have x = 3 and y = 4 if memberwise copy works

Link to comment
Share on other sites

  • 0


if __name__ == "__main__":

    #create a maze checker

    check = MazeChecker()

    #mostly used for exiting whiles

    okay = True

    #create 10 players

    tournament = [Player()]*10

    tournament[0].name = " "

    tournament[1].name = " "

    tournament[2].name = " "

    #create storage for mazes

    mazeArray = [0]*10

    #generate mazes and check them

    for i in range(0,len(tournament)):

        #create each player's maze.

        mazeArray[i] = tournament[i].MazeGen()

	#check the boarder

        okay = check.boarderCheck(mazeArray[i])

	if not okay:

            print tournament[i].name

	#make sure litigamate path.

        while okay:

            went = check.pathFinder()

            check.turns += 1

            check.suoth = mazeArray[i][check.coor[0]+1][check.coor[1]]

            check.north = mazeArray[i][check.coor[0]-1][check.coor[1]]

            check.east = mazeArray[i][check.coor[0]][check.coor[1]-1]

            check.west = mazeArray[i][check.coor[0]][check.coor[1]+1]

            if went == "Stay" or went == "no path found":

                okay = False

            if not okay:

                check.printMaze(mazeArray[i])

        check.turns = 0

	#the main tournament loop

    for i in range(0,len(tournament)):

        for j in range(i+1,len(tournament)): 

	    #curMaze points to maze array j

	    curMaze = mazeArray[j]

	    #curPlayer points to tournament[i]

            curPlayer = tournament[i]

    	    playerAgainst = tournament[j]

            okay= check.boarderCheck(curMaze)

	    #intialize variables.

            curPlayer.goal = check.goal

            curPlayer.coor = check.coor

            curPlayer.north = check.north

            curPlayer.south = check.south

            curPlayer.east = check.east

            curPlayer.west = check.west

            curPlayer.direction = check.direction

            while okay:

	    #execute the traverser once per loop.

                went = curPlayer.Traverser()

                if went == "done!":

                    break

		#allow player to change his current location.

                if went == "stay":

                    check.coor = curPlayer.coor

  		#update location based on direction traveled.

                elif went == "north":

                    check.coor[0] += 1

                elif went == "south":

                    check.coor[0] -= 1

                elif went == "east":

                    check.coor[1] += 1

                elif went == "west":

                    check.coor[1] -= 1

		#update direction

                if went != "stay":

                    curPlayer.direction = went

		#give player new surroundings based on new location

                curPlayer.north = curMaze[check.coor[0]+1][check.coor[1]]

                curPlayer.south = curMaze[check.coor[0]-1][check.coor[1]]

                curPlayer.east = curMaze[check.coor[0]][check.coor[1]+1]

                curPlayer.west = curMaze[check.coor[0]][check.coor[1]-1]

		#playerAgainst score gets incremented for every turn he makes curPlayer take.

                playerAgainst.score += 1

                curPlayer.turns += 1

		#now have player j go through player i's maze.

            curMaze = mazeArray[i]

            curPlayer = tournament[j]

	    playerAgainst = tournament[i]

            okay= check.boarderCheck(curMaze)

            curPlayer.goal = check.goal

            curPlayer.coor = check.coor

            curPlayer.north = check.north

            curPlayer.south = check.south

            curPlayer.east = check.east

            curPlayer.west = check.west

            curPlayer.direction = check.direction

            while okay:

                went = curPlayer.Traverser()

                if went == "done!":

                    break                           

                if went == "stay":

                    check.coor = curPlayer.coor 

                elif went == "north":

                    check.coor[0] += 1

                elif went == "south":

                    check.coor[0] -= 1

                elif went == "east":

                    check.coor[1] += 1

                elif went == "west":

                    check.coor[1] -= 1

                if went != "stay":

                    curPlayer.direction = went

                curPlayer.north = curMaze[check.coor[0]+1][check.coor[1]]

                curPlayer.south = curMaze[check.coor[0]-1][check.coor[1]]

                curPlayer.east = curMaze[check.coor[0]][check.coor[1]+1]

                curPlayer.west = curMaze[check.coor[0]][check.coor[1]-1]

                playerAgainst.score += 1 

                curPlayer.turns += 1

        for i in range(0,len(tournament)):

            print tournament[i].name

	    print tournament[i].score/tournament[i].turns

            print

i went with your code for the most part simply because is about 10x easier to read.

i went ahead and commented the code.

only one of your corrections wasn't correct :-)

Link to comment
Share on other sites

  • 0

i went with your code for the most part simply because is about 10x easier to read.

i went ahead and commented the code.

only one of your corrections wasn't correct :-)

Glad to help! :thumbsup:

One more thing...is Python string comparison case sensitive? Your capitalization of string literals isn't consistent throughout the code. If case sensitivity makes a difference, you could have some pretty bad behavior. :blink: Though I'm not sure how scoping works in Python, you could remove all of the directional strings (north, east, south, west, done!, stay) to globally scoped variables. That way, they'll all be consistently named (if it makes a difference) and the code should crash if you've misnamed one of the variables (instead of possibly looping infinitely or blowing up in unexpected ways :o ).

Link to comment
Share on other sites

  • 0

good point, yes python is string comparison case sensitive. I'll add that to the code.

about global and local; anything defined in the main function is automatically a global variable; so it won't be a difficult change. (so technically speaking you have access to whole maze if you don't mind cheating.)

Link to comment
Share on other sites

  • 0

You said that Java was fine for submission of code and I'm a little curious how that works if your program is in Python. Does Python have some method of converting Java to Python or will you have a Java version as well? If you intend to do a manual conversion of people's code from Java to Python, I suspect that my code will be a bit of a pain to convert (when it's finally done, of course :rolleyes: ).

So how do you intend to handle that? Also, have you had any submissions yet? This is actually a pretty hard problem (especially if you are trying to create a smart program :ph34r: ).

Link to comment
Share on other sites

  • 0

no, i haven't had any submissions yet. java to python is actually fairly simple i think, basically similar logic. but if necessary I'll write a java version of my code (that might be the easier route).

Link to comment
Share on other sites

  • 0

This is a bit of a bump to see what's happening with this. I've been pretty busy lately and haven't gotten anything done with this until recently. Such as it is, it isn't finished, but I've got a partial algorithm working for maze generation, and a theoretical algorithm for path finding (in the sense that I think it should work, but I haven't tested it yet :) ). It still needs some modifications to fit the restraints of the rules, but it's a start.

Has anyone submitted anything yet? Are we still planning to do this? :unsure: I can't give a timeframe for when I'll be done with mine, but I hope it will be soon.

Link to comment
Share on other sites

  • 0

By generate a maze, do you mean on the fly from scratch, or just to generate the required answers based apon current location and available moves on a predefined map?

I'm most definately a late starter on this, and i'm still trying to get my head around the idea of what you are looking for. These arn't stand alone programs, but function trees to be added to a main program to run the comparision, right?

If the latter is true, then are we allowed to store previous runs at the other mazes to work with a pattern examples for the next run? Was thinking about try to make two traversing algorithms for the task, one static, and one fuzzy logic based on what has been done so far.

It might take me a while to get the second one up and running, but once the ground work has been done for the first, the logic should flow pretty smoothly.

Any thoughts?

Venomi

Link to comment
Share on other sites

  • 0

you should have two functions, a maze generator, and a maze traverser. the maze gernator would be from scratch and should generate the whole 50x50 maze in one call of the function. (if yours needs multiple calls let me know). the maze traverser however will be called again and again ,and will only be given the four directions, the current direction you are facing, the goal location, total moves taken, and a storage array(this you can use any way you see fit). note however each maze traverser will go though every other maze only once.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...