VB6 Only, I've been unable to find anyone with enough time to convert the helper project to VB.NET. Sorry about that.
Deadline
The dealine for this contest will be Sunday 10th October (Mid-day, BST). This maybe extended pending requests.
Main Aims
You have been given a VB6 project which displays a maze and a little player. You the project also contains 3 "Control" functions that have been put in the forums Code, these are Look(), LookAbout() & MovePlayer(). All your code must be in the module called "Controller", in this module we have placed a function named StartGame(), this is the entry point for your code. The only way you can interact with the rest of the program should be though the three "Control" functions. An example of what is expected has been put in the StartGame() function however its by no means any good.
Using this you must turn StartGame() into a AI function that will guide the player though the maze. The size of the grid is not fixed and the starting position (or end position) is not given.
The three functions do the following:
Look()
This function take a parameter for the direction to look in as a Byte, 1 - North, 2 - East, 3 - South & 4 - West. It then returns a bool to tell you if that direction is clear.
LookAbout()
This is the same as Look() in a way but it takes 4 ByRef parameters and these are 4 bools, when the function is called it returns whether the routes are blocked though these parameters.
MovePlayer()
This function takes a byte as a parameter the same as Look() and it will attempt to move the player in that direction. The function does not return if the move was allowed though, if the route was blocked then the function runs as if it wasn't. The function does return a bool but the purpose of this is just to tell you if the player has reached the end yet.
How Is It To Be Marked?
A marking scheme has been produced and implemented into the project so you can see how well your code is doing. The scoring is based on how many times you call each of the three "Control" functions and each has a different weighting as shown below:
Look() - 2 Points
LookAbout() - 6 Points
MovePlayer() - 3 Points (Independant of whether the player was able to carry out the move)
As you may see it could be an idea to just run round the maze blind and the points might not be as high but then again you could make lots more moves then needed if you do that.
We will be running your code with a variety of different maps of sizes ranging upto 300x300 and will be recording the scores. Whoever gets the lowest score overall will be the winner. We have included 3 test maps so you will be able to test your code on them for now.
What Do I Win?
The prize for this contest is yet to be announced but at the least it will be another Custom Title Status but I am hoping we will be allowed to make it include Color Tags, like Brads or VisualAds .
Where Do I Send My Work?
To submit your work create a new Thread in the Contest Entries Sub-Forum. Please title your Threads "Contest 2, PathFinder - Username", changing Username for your username. Attach a Zip file to the post and include just your Controller module.
Any Querries?
If you have any questions then your welcome to send me a PM or any of the other people running the contests.
Last edited by Electroman; Oct 4th, 2004 at 06:55 PM.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
I just wonder what is the point of the whole thing... it is impossible to look for a route without moving the player. Thus, in the end, I have to run through the whole maze (not even knowing the size of it) until it finds the final goal by luck. I feel very limited. This is no good as it is now - very very uninspiring, even if I have some ideas.
Its not a case of planning your way though exactly, I suppose some luck is brought into it, its more of an acurate way that you would find your way though a maze if you were in the maze. If you were put in a maze you would not know anything about the maze apart from the imidiate area around you.
Its not just a case of moving lots and hoping you get to the end eventually as there are different approaches you can take. There is also different scoring depending whether you choose to use the Look() or LookAbout() Functions which will come into your strategy of doing this.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Posted by Merri Edit I were the second to download it.
Thanx, I will remove the notcie now then. manavo11 Was the first but he had already told me so I just wrote that there was only one .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
I think this one is interesting! I've never worked with AI before, and now I have a reason to do it. Millions of ideas are poping up in my head right now
Originally posted by Merri As the rules started, you aren't allowed to edit the previously done functions. The only thing you can change is the controller module.
Electroman: could you post it into a new post, I'm still getting the old version.
Clear your browser cache...
Has someone helped you? Then you can Rate their helpful post.
Ok well the first immediate problem I see is this, in the picture shown above the player takes up one block. The exit is in the center of a room the size 3 x 3. So its basically going to be dumb luck that the program happens upon the exit block in that room. Would it not be better to make the exit the first block upon entering that room. Or to at least to add another function LookAboutExit() that returns true if the exit is one block away in the respective direction. Heck you could even make such a function cost 10 points per use to make sure people dont abuse it.
If this seems like a bad idea then I guess its just another hurdle to overcome, but I agree with Merri that the whole project seems more like blind luck than an actual AI, the only AI part would be to ensure your progy isn't stupid enough to run back down dead ends that it already went down.
You said it makes it more like a person actually in the maze themselves and only knowing what is around them but a human in a maze like this has an advantage, perspective.. they can see how long a hall is and a lot of times would probably be able to tell if there is an opening down a shorter hall or not (longer ones would be harder to see).
Oh blah I guess I should stop focusing on the limitations and just code it huh? Interesting project to say the least and I should have fun finding a way to do it even if it is more random than AI
Yea My car just got broken into just before manavo told me about the other error so I've been sorting that out.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Posted by StevenHickerson Ok well the first immediate problem I see is this, in the picture shown above the player takes up one block. The exit is in the center of a room the size 3 x 3. So its basically going to be dumb luck that the program happens upon the exit block in that room. Would it not be better to make the exit the first block upon entering that room. Or to at least to add another function LookAboutExit() that returns true if the exit is one block away in the respective direction. Heck you could even make such a function cost 10 points per use to make sure people dont abuse it.
I put that in so you wouldn't think about it as just corridors. This way not all the algos you find on Google will fit straight in .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
My algo is huge so far and really stupid!
I get 198 points on the first map, 502 on the second, and on the third it gets locked into an infinite circle at about 450 points!
I've added some small memory for the player, but I'm a bit confused on how to deal with it the best way...
Maybe it's a good idea to add a bit of random movement, so you don't get stuck... But then it's not possible to measure the same way....
Originally posted by Electroman
So far it looks like we will be making this just VB6 because we've been unable to get a VB.NET version of the project made.
Posted by wossname Do you want me to write one for you?
If you could please. You needn't mark them though, this way you'll be able to take part too.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
BTW I set the deadline at just over a week but as some of you are finding out its not as simple as you might think. So if you need more time let me know and if there is a few people saying this I'll increase it .
I think I'll have a go at this one myslef too, although I won't get ranked at the end .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Ok. Just thinking off the top of my head,
If you were to run this in the Development Environment, then we could code it to read the frm files in the app.path, see if anything interesting exists, like any lines resembling App.Path & "\Route1.txt", or some such.
'Course, not sure what I'd do with such extracted info.
'Course, you could easily trojan some txt file up.
'Course, you're surely not going to let us access the maze dat so easily.
hmmm, just musing over this little, stray, distraction of a thought.
Ok. Just thinking off the top of my head,
If you were to run this in the Development Environment, then we could code it to read the frm files in the app.path, see if anything interesting exists, like any lines resembling App.Path & "\Route1.txt", or some such.
'Course, not sure what I'd do with such extracted info.
'Course, you could easily trojan some txt file up.
'Course, you're surely not going to let us access the maze dat so easily.
hmmm, just musing over this little, stray, distraction of a thought.
Don't forget I only asked you to submit your module file and that the only thing you can relie on is that those 3 functions will be avialable. For example I may rename the frm file, I may totally change the file format of the map data files.
I have thought of a few ways you could "cheat" but instead of saying you can't do them I thought that I would leave them open and see if anyone thought of them. But seen as though I just made the previous statement that the only thing you can relie on being those 3 functions I guess that should make everyone play fair. Saying that this contest isn't close to impossible so you shouldn't find the need to cheat .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Posted by wossname Ok. I'll start it tonight and I'll get it done ASAP.
I don't mind marking them. I will not show any favouritism unless I am paid in cash.
W00t!111!!!!!1!!1!1!oneoneeleven
, Thanx .
For the marking all we have to do is run the code and record the Score so manavo11 will probably do that as he has VB.NET and access to the secret Hide out (opps, I mean Private Moderators Section).
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Just curious but does anyone have an algo that compeletes all three maps yet?
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Originally posted by Electroman Just curious but does anyone have an algo that compeletes all three maps yet?
Yep. Keeping my cards close to my chest at the moment. There is still room for improvement.
Electro: How many .Net entries did you receive for the last competition? I know me and Mendhak did but were there any others? It's a major rebuild to rewrite your VB6 app for .net, and the auto convert tool in VS.net can't upgrade things like AutoRedraw and Redim(,).
If there are more than 6 VB.net coders then I'll do it, otherwise its not really worth the effort.
Question: Can I check the form's caption? I just realized that move player doesn't add any points if the man doesn't move. And I can use the form's caption to figure out if the score change.
Don't pay attention to this signature, it's contradictory.
My algo is huge so far and really stupid!
I get 198 points on the first map, 502 on the second, and on the third it gets locked into an infinite circle at about 450 points!
I've added some small memory for the player, but I'm a bit confused on how to deal with it the best way...
Maybe it's a good idea to add a bit of random movement, so you don't get stuck... But then it's not possible to measure the same way....
Please tell me what you get!
My algo completes all 3 maps fine... but that's because it searches every possible location... I still need to tweak it to avoid stupid things like that...
I scored 1246 on the second map because of it's large area to the east.
Don't pay attention to this signature, it's contradictory.
It would really be nice if "look" returned how many blocks to the first wall in that direction. That would contrast it from lookabout nicely. But then it would be worth more points...
So far I see almost no reason to use lookabout, better off running almost blind with look.
Don't pay attention to this signature, it's contradictory.
Originally posted by alkatran It would really be nice if "look" returned how many blocks to the first wall in that direction. That would contrast it from lookabout nicely. But then it would be worth more points...
So far I see almost no reason to use lookabout, better off running almost blind with look.
Posted by alkatran Question: Can I check the form's caption? I just realized that move player doesn't add any points if the man doesn't move. And I can use the form's caption to figure out if the score change.
The Move should add points on whether or not the move was possible.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
I found a bug. The reason it wasn't working is it gets stuck in an infinite loop:
If the move fails TARGETX and TARGETY are NOT SET so they are 0. That and the position of the dot doesn't move. So the condition:
Loop Until picPlayer.Left = TargetLeft And picPlayer.Top = TargetTop
is never satisfied
That's why the score wasn't moving.
Don't pay attention to this signature, it's contradictory.
I realized how little data we had just by reading about the three functions.
Here is a fix to the MovePlayer function. I'm sure this is easier to copypaste than to download the whole project again.
VB Code:
TargetLeft = picPlayer.Left
TargetTop = picPlayer.Top
Select Case Direction
Case 1 'North
If CurY > 0 Then
If Not (MapData(CurX, CurY - 1) = 1) Then
DirToMove = 1
CurY = CurY - 1
TargetTop = TargetTop - 25
End If
End If
Case 2 'East
If CurX < MapWidth - 1 Then
If Not (MapData(CurX + 1, CurY) = 1) Then
DirToMove = 2
CurX = CurX + 1
TargetLeft = TargetLeft + 25
End If
End If
Case 3 'South
If CurY < MapHeight - 1 Then
If Not (MapData(CurX, CurY + 1) = 1) Then
DirToMove = 3
CurY = CurY + 1
TargetTop = TargetTop + 25
End If
End If
Case 4 'West
If CurX > 0 Then
If Not (MapData(CurX - 1, CurY) = 1) Then
DirToMove = 4
CurX = CurX - 1
TargetLeft = TargetLeft - 25
End If
End If
End Select
And btw, Electroman: you can't change the name of the main form, because that'd make everyone's code not to work - they're calling frmMain all the time!
Originally posted by Merri And btw, Electroman: you can't change the name of the main form, because that'd make everyone's code not to work - they're calling frmMain all the time!
I only call it three times.
Don't pay attention to this signature, it's contradictory.