Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Best AI programming language?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
38 replies to this topic

#1 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 06 October 2009 - 08:44 AM

Hi! I have thought of making some implementation of AI in chess (in the evaluation function), based on some form of artificial programming, maybe trial and error. First I thought of making one which uses Lisp, but then I thought that I should better check before if there is any better suited language, some that is more often used today than Lisp is... Do you know which language is most often used, or which is the best to use? If Lisp, which dialect should I use, CL or Scheme? And since I am new to AI and artificial programming, is there any good articles I should read about it before I give it a try? I know the basics of genetic programming, but I don't really see why I should keep more than one AI generated program at the same time when they probably will work in about the same way, at least not in this case. By the way, I read a book before sometime which contained a chapter about a computer or a computer program (don't know which) called Eurisko (you can see http://en.wikipedia.org/wiki/Eurisko). Ever heard of it? I think that used Lisp too, or at least something similar. That computer achieved some amazing things! Does anyone know how it worked? It would be really awesome if my program could do about the same thing!

Sponsor:

#2 Sneftel   Senior Moderators   -  Reputation: 1781

Like
-1Likes
Like

Posted 06 October 2009 - 08:58 AM

LISP has historically be considered The Language For AI, because its history and the history of early Natural Language Processing are deeply linked. Don't read too much into that, though. There is very little specific to AI which is uniquely well handled by LISP. I'll let others weigh in on the LISP variant war.

You should look into minimax, alpha-beta pruning, and transposition tables. Don't be seduced by the buzzwordiness of genetic algorithms and ANNs. They are not a panacea.

Eurisko is a cool technology, but it's probably not particularly applicable to chess, since (IIRC) it has limited formal look-ahead ability. I could be wrong about this, though.... I haven't really looked at it in a while.

#3 IADaveMark   Moderators   -  Reputation: 2509

Like
0Likes
Like

Posted 06 October 2009 - 09:05 AM

Not to be trite, but this is similar to asking "what is the best language for writing song lyrics?" The best programming language for AI is the one that the rest of your application speaks. If you are going to be writing the rest of your stuff in C++, why bother with LISP? If you are going to be coding in Java, why would you use VB? Exceptions to this are things that are designed to go together such as Lua plugins to C++.

General AI concepts are highly language-independent. Use whatever you are comfortable with that is capable of supporting what you need to do. (e.g. if you need recursion or flexible container classes, then the language must support those)
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
Author of the book, Behavioral Mathematics for Game AI

Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

#4 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 06 October 2009 - 10:47 AM

Thanks. I know about alpha-beta pruning, and also about transposition tables. I am going to use these too. Well, I look at this project more as an attempt to create something that is creative, that can come up with ideas about what a good position should look like. If it is possible to do it at all with artificial programming.

I have an idea of how this can be done:

I start by creating a very basic evaluation function of course (which will make the program able to play a somewhat reasonable game that is not totally random). Then a number of random but common game positions (maybe from past games or the previously played one) is taken. All of these positions will have their own values, given by the estimation function.

However, these values are just estimations of the current state of the game (which player has the advantage and how big), and we want them to be better. And that is achieved by looking several moves ahead, although looking only a few moves ahead will also improve the estimations. So, every position is given a new value, taken from looking one or two moves ahead (depending on if it necessary that it is the same players turn again, or not), using min-max or alpha-beta pruning (these values can act as "true values", for example if a neural network and backpropagation would have been used instead). It is probably also possible (it should be in some way) to try to make small modifications of the evaluation function, to better match the new values. If such a modification is found, it is applied to the evaluation function. This is however only a method for improving the evaluation method, then it is used as normal when a real game is played.

Does this make sense at all?

Otherwise, it could just try modifying the code a little bit and play one or a few games against the old code, to see if it improved.

The reason I asked about what language to use is that I want to find an easy language to implement it in. With Lisp for example requires quite little (I guess) to write the interpreter (and also the code generator) in comparison to if other, more complex languages like C, or worse, C++, are used. The generated program still has to be able to perform well though.

#5 alexjc   Members   -  Reputation: 450

Like
-1Likes
Like

Posted 06 October 2009 - 02:14 PM

If you have no idea where to start, Python. If you want to get into industry, C++. :-)

Join us in Vienna for the Game/AI Conference 2014, on July 7-10... Don't miss it!


#6 Álvaro   Crossbones+   -  Reputation: 13645

Like
0Likes
Like

Posted 07 October 2009 - 03:59 AM

This is potentially an interesting project. The best attempt at this kind of thing I've seen was some paper in the early 90s where they converted positions into graphs (where a link represents a piece attacking a square) and then trying to automatically generate a database of useful patterns with associated values. The evaluation function would then consist of identifying the patterns that might be present and adding their values up.

Another, more limited approach was KnightCap, which used TD learning to auto-tune parameters in its evaluation function.

The tough part about this is what algorithm to use, not what language to express it in. I would do it in C++ because that's what I am more used to, but you can use anything else.



#7 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 07 October 2009 - 10:36 AM

I have never heard about C++ script before. Is it common to use it? I have heard that C++ is a very difficult language to parse, if you compare it to for example C. That is if you are going to use classes, templates and polymorphism of course, but what good is it without all that?

C seems complex enough to make a script language of. Is it sure it isn't easier making it in Lisp, I mean, you basically just got a loot of parenthesis in Lisp, and you don't have to bother about precedence or associativity of the operators. Lisp only allows one operation, or "function", at each depth in an expression.

Then of course, you are the game programmers, so you probably know better! I guess many of you have been coding in some project which used scripting. Which language did you script in; is it possible to script in C++? Did you use your own parser (script interpreter) or did you use an external one? Is there any good parsers out there that you can use?

Just exploring!

-Kristofer

#8 Haladria   Members   -  Reputation: 132

Like
0Likes
Like

Posted 07 October 2009 - 10:47 AM

Isn't the whole point with using a script language to avoid developing everything in C++ because of all it's drawbacks, so I see no good reason to have a pure C++ script language?

I recommend for example Lua (used in many good games, for example ai in supreme commander)
http://lua-users.org/wiki/LuaUses



#9 Álvaro   Crossbones+   -  Reputation: 13645

Like
0Likes
Like

Posted 07 October 2009 - 12:41 PM

Why do you think you need scripting for this?

#10 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 07 October 2009 - 07:27 PM

Quote:
Original post by alvaro
Why do you think you need scripting for this?


Because it's supposed to be research, not game making in first hand.

#11 Rattenhirn   Crossbones+   -  Reputation: 1781

Like
0Likes
Like

Posted 07 October 2009 - 09:03 PM

Quote:
Original post by TriKri
Hi! I have thought of making some implementation of AI in chess (in the evaluation function), based on some form of artificial programming, maybe trial and error.


I wouldn't start with chess, it's a very complex game. In fact, most classic board games (chess, checkers, backgammon, go,...) are very complex. Even if you spend a lot of time, you're AI will most likely either play very bad or take a very very long time to think.

As for programming language: It doesn't really matter! Pick the one you know best, unless you want to learn a new language in the process, then pick one you'd like to know.

[Edited by - Rattenhirn on October 8, 2009 3:03:39 AM]

#12 Relfos   Members   -  Reputation: 321

Like
0Likes
Like

Posted 07 October 2009 - 09:41 PM

If I understand TriKri correctly, he thinks that the code for artificial inteligence needs to be generated dynamically (that's why he's talking about parsing C++ and lisp and such things).
TriKri, you should read some more before starting coding this, as it seems you dont graps the basic ideas at all.

#13 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 07 October 2009 - 10:33 PM

Quote:
Original post by Relfos
If I understand TriKri correctly, he thinks that the code for artificial inteligence needs to be generated dynamically (that's why he's talking about parsing C++ and lisp and such things).
TriKri, you should read some more before starting coding this, as it seems you dont graps the basic ideas at all.


Can you please explain that a bit further, why don't I have to generate code dynamically? That is exactly what I want to do. What I want to achieve is a "creative" AI, and that can only be done by letting it formulate new ideas (and try them out), in this case code.

#14 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 07 October 2009 - 10:41 PM

Ideas don't have to be expressed as code. They can be data that states how to combine pre-existing behaviour. In fact I would say code is a poor representation for creative ideas because it isn't sufficiently constrained to the problem domain.

#15 Álvaro   Crossbones+   -  Reputation: 13645

Like
0Likes
Like

Posted 08 October 2009 - 01:56 AM

If you want your program to be creative, first you need to know what you mean by that. Is Rybka creative? What test would you use to determine it?

I am a natural Wittgensteinian, and I only understand words in their context. I don't think "creative" is a word that means anything when applied to a chess program. It makes sense to use it for human chess players that can think of things other humans miss. "Creative moves" can also be simply surprising moves that happen to work only because their opponents don't know how to counter them. When applied to programs, it's a metaphor at best.



#16 TriKri   Members   -  Reputation: 124

Like
0Likes
Like

Posted 08 October 2009 - 10:01 AM

Quote:
Original post by Kylotan
Ideas don't have to be expressed as code. They can be data that states how to combine pre-existing behaviour.


That sounds interesting. How do you mean combine pre-existing behaviour, can you give an example of it? Can it for example be applied to chess? Or to any other interesting game?

Quote:
Original post by alvaro
If you want your program to be creative, first you need to know what you mean by that. Is Rybka creative? What test would you use to determine it?


alvaro, I haven't heard about Rybka before, actually I'm not that into chess myself, I just use it because I find it an interesting game. Hm, the strongest chess engine in the world? I'd better check it out!

I do think creativity can mean something when applied to a chess program as well. For sure, there has to be some kind of definition of what creativity is, and that has to be applicable to a computer program as well. My idea of creativity is that a person who is creative comes up with new ideas all the time, which he doesn't know if they are going to work or not, and tries them out. Regardless of if his ideas worked or not I think that is creativity, because he is sooner or later going to find something that will work. In other words, what I am being now. What is your idea of creativity?

[Edited by - TriKri on October 9, 2009 2:01:48 AM]

#17 Álvaro   Crossbones+   -  Reputation: 13645

Like
0Likes
Like

Posted 08 October 2009 - 02:21 PM

Quote:
Original post by TriKri
What is your idea of creativity?


I sort of answered that in my previous post. I think words are only meaningful only in the context in which they are normally used, and the search for human attributes like creativity or consciousness in machines is futile if you don't clearly define what you mean by them in this new context, in a testable way.



#18 egwenejs   Members   -  Reputation: 122

Like
0Likes
Like

Posted 08 October 2009 - 02:42 PM

Instead of being creative - if you're doing research why not try to 'solve' the chess problem. It's been done for checkers, so now someone should do it for chess. The link for checkers if you haven't seen is http://www.cs.ualberta.ca/~chinook/

#19 owiley   Members   -  Reputation: 136

Like
0Likes
Like

Posted 08 October 2009 - 03:54 PM

I was thinking that AI was ok just about any language and didn't realize that they was a history about it all ready.

#20 dj3hut1   Members   -  Reputation: 106

Like
0Likes
Like

Posted 09 October 2009 - 08:18 AM

Hello,

why not use a logic programming language like Prolog or a constraint logic programming language? ( f.e. http://eclipse-clp.org/ )





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS