### Author Topic: Help for my AI  (Read 3424 times)

0 Members and 1 Guest are viewing this topic.

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
##### Re: Help for my AI
« Reply #15 on: February 08, 2011, 02:16:20 PM »
Oh, right.  Well, when you come to do it in school, they probably won't give you many practical examples of what it is used for.
Or if they do, they'll be totally boring and relatively pointless, like "Jim has two pieces of wood as shown.  How much string will Jim need to tie one end of the wood to the other?"

That was my experience, anyway.

In fact, pythagoras is about the most useful equation you could possibly know for coding.  It's used for absolutely loads of stuff - usually where you need to calculate the distance between two objects.  It features prominently in the AI engine, the gravity engine, and the 3D starfield engine.  The position of stars in the latter is actually calculated using just 4 lots of pythagoras calculations.  :>

For a quick run over pythagoras, see here: http://www.bbc.co.uk/schools/ks3bitesize/maths/shape_space/pythagoras_theorem/revise1.shtml

Let me know if that link doesn't make sense.. :>

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
##### Re: Help for my AI
« Reply #16 on: February 08, 2011, 02:28:55 PM »
Also, if you learn about it now then when they try to teach you about it in school you can tell them all about it, and how you've already written your own artificial intelligence engine that uses those calculations.  :>  I should imagine your maths teacher will be all like o.O

:>

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #17 on: February 08, 2011, 02:29:57 PM »
Wow, I learnt something, but I need to check the site once again if i need to know once more

But one thing is confusing the first time you look at page 2:

In b in the question in page 2:

The smalest side with 5cm is higer than both 13 and 12 cm it looks like, which cause confusion unless you study it closely.

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• Posts: 1,794
##### Re: Help for my AI
« Reply #18 on: February 08, 2011, 02:31:56 PM »
Yeah it's not very clear that, is it?  But yea, if it helps, just draw your own triangle that IS to scale.. :>

By the way, page 5 has an example that is _exactly_ the sort of thing you might need to do in Eufloria.  You can imagine that those 2 points on the graph are actually asteroids...

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #19 on: February 08, 2011, 02:32:02 PM »
Hah, the math teacher will(and the whiole class too) be like "He said WHOOT?!"

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #20 on: February 08, 2011, 02:33:23 PM »
I would rather do that than looking at a confusing picture again xD

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #21 on: February 08, 2011, 02:38:14 PM »
What am I doing, I am combining two parts in my engine into one and hoping it works properly

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #22 on: February 08, 2011, 05:13:15 PM »

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Help for my AI
« Reply #23 on: February 08, 2011, 05:56:06 PM »
One little thing...

Math.sqrt() is fairly processor-heavy. However, you do not have to square-root the hypotenuse (longest side) to compare distances, because if length A is greater than length B, A^2 will always be bigger than B^2.

EDIT: Also, if you do get it to learn from mistakes, and the IO library is solved, you could have your AI store its knowledge elsewhere, and learn more and more every match it plays. Though I think that may be a little hard.
« Last Edit: February 08, 2011, 05:59:31 PM by Pilchard123 »

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #24 on: February 08, 2011, 06:13:48 PM »
Mhm, I know square root is a heavy task... May say that to annikk too, cause his AI uses it too

EDIT: My computer runs 58(I think) roids fine with three runs per while loop

And I think the AI should be reset everytime you play, because then you can play diferently against "the same AI" adn I jsut gotta get over the barriers of problems before I start with the learning for real...

My plan:
1st: Finish seed movement and tree planting
2nd: Allow flowers to be used
3rd: IF gatheringpoints are bugged(which they would be I guess) fix them.(mainly called include, but they are there already )
4th: AI learning

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Help for my AI
« Reply #25 on: February 08, 2011, 06:18:52 PM »
stuff

And I think the AI should be reset everytime you play, because then you can play diferently against "the same AI"

more stuff

That's my point. If you were to make what it learns usable in other matches, it would force you to play a different style eventually, because it would know how you play, and play to beat that. If it was reset every time you started a level, you could play the same strategy every time, and it wouldn't know any better.

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #26 on: February 08, 2011, 06:35:28 PM »
Mhm, maybe I'll add it, IF POSSIBLE and I know how...

In the meantime I have a god damn problem about the game crashing right after a tree reaches the core, but only by the AI...

#### Pilchard123

• Tester
• Old Oak
• Thank You
• -Given: 0
• Posts: 899
• Eufloria: Yes
##### Re: Help for my AI
« Reply #27 on: February 08, 2011, 06:39:37 PM »
Yeah, if possible is the main problem there...

#### Aino

• Ent
• Thank You
• -Given: 1
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: Help for my AI
« Reply #28 on: February 08, 2011, 06:41:41 PM »
Ye, else we just gotta live with the same AI reseting, untill it is posiible(if it will ever be

• Ent
• Thank You
• -Given: 1