Turtleai
#1
Posted 25 February 2012 - 10:21 PM
By Shadow
Wanderer AI
Essentially this is and I quote 'a blind & drunk' turtle AI. It is my first AI so, it is very simple. It just picks a random direction and goes in it.
Download: http://www.4shared.c.../Wander_AI.html
Pathfinder AI
This a somewhat a more advanced AI than the Wanderer. When it detects a wall, it either turns left or right. The constant 1 direction bug in the video is fixed.
Pathfinder goin through a maze:
Download: http://www.4shared.c...hfinder_AI.html
Pathfinder II
I made a much better version of the pathfinder, coded from scratch, it requires Techzune's TurtleAPI found here: http://www.computerc...zunes-programs/
When it gets to a wall, it checks left and right and then goes either left if right has a block, right if left has a block, and if both sides have a block, it turns around. Also, this is my first proper AI.
Download: http://www.4shared.com/file/LVMKg9ma/AI__4_.html
#2
Posted 26 February 2012 - 12:25 AM
#3
Posted 26 February 2012 - 02:46 AM
you should add the code to the topic
#4
Posted 26 February 2012 - 04:43 AM
Artificial Intelligence means that it makes decisions based on its surroundings(Similar to how a human or animal does) which this does not this just chooses a random direction when it hits a wall.
#5
Posted 26 February 2012 - 11:30 AM
#6
Posted 26 February 2012 - 12:59 PM
while turtle.detectDown()==true then <your program> endIf you destroy block on floor on exit program will stop, and after that something can be printed.
#7
Posted 26 February 2012 - 08:55 PM
tomass1996, on 26 February 2012 - 04:43 AM, said:
Artificial Intelligence means that it makes decisions based on its surroundings(Similar to how a human or animal does) which this does not this just chooses a random direction when it hits a wall.
#8
Posted 27 February 2012 - 05:40 AM
Found here: http://www.computerc...zunes-programs/
It is not here yet though.
#9
Posted 27 February 2012 - 09:00 PM
#10
Posted 28 February 2012 - 03:24 PM
That uses the 'keep your right hand always on the right wall'-technique. So if it can go right, it will, if it can't, it'll check for going forward and if that is not possible it'll try going left.
This way the bot always comes to the exit, no matter how complicated the maze. (Note, the paths must be 1 wide and the exit must be marked with the absence of a block under the bot.)
This is still a 'dumb'-ai. The real challenge would be mapping the entire maze by walking trough it and then determining the best path. I believe Cruor is trying to achieve that.
-Chub1337
#11
Posted 28 February 2012 - 08:54 PM
Chub1337, on 28 February 2012 - 03:24 PM, said:
That uses the 'keep your right hand always on the right wall'-technique. So if it can go right, it will, if it can't, it'll check for going forward and if that is not possible it'll try going left.
This way the bot always comes to the exit, no matter how complicated the maze. (Note, the paths must be 1 wide and the exit must be marked with the absence of a block under the bot.)
This is still a 'dumb'-ai. The real challenge would be mapping the entire maze by walking trough it and then determining the best path. I believe Cruor is trying to achieve that.
-Chub1337
#13
#14
Posted 29 February 2012 - 09:29 AM
mrminer844403, on 29 February 2012 - 05:01 AM, said:
I still don't get it, where in this code does it remove a block?
Code:
while true do turtle.turnRight() if turtle.detect() == true then turtle.turnLeft() if turtle.detect() == false then turtle.forward() else turtle.turnLeft() if turtle.detect() == false then turtle.forward() end end else turtle.forward() end if turtle.detectDown() == false then --If it hasn't got a block under it anymore, it has reached the exit and stops. break end sleep(0.1) end
it only detects blocks, and if there is none, it'll move forward (since there is no block, thus a path).
Also , the part where it detects down, this is to check if it's at the finish, it doesn't break the block underneath it, it breaks the loop.
breakis for breaking a loop, like here it breaks the
while true do endloop, otherwise it would continue forever.
turtle.dig()is for breaking blocks
-Chub1337
#15
Posted 01 March 2012 - 08:40 AM
Chub1337, on 29 February 2012 - 09:29 AM, said:
mrminer844403, on 29 February 2012 - 05:01 AM, said:
I still don't get it, where in this code does it remove a block?
Code:
while true do turtle.turnRight() if turtle.detect() == true then turtle.turnLeft() if turtle.detect() == false then turtle.forward() else turtle.turnLeft() if turtle.detect() == false then turtle.forward() end end else turtle.forward() end if turtle.detectDown() == false then --If it hasn't got a block under it anymore, it has reached the exit and stops. break end sleep(0.1) end
it only detects blocks, and if there is none, it'll move forward (since there is no block, thus a path).
Also , the part where it detects down, this is to check if it's at the finish, it doesn't break the block underneath it, it breaks the loop.
breakis for breaking a loop, like here it breaks the
while true do endloop, otherwise it would continue forever.
turtle.dig()is for breaking blocks
-Chub1337
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











