Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My aim is to, via pattern analysis and statistics, (as well as piece mobility and position) build a chess position evaluation analyzer (rather than simply going brute force ply-searching).

Id like to hear some thoughts a language that will be interesting/fun/challenging to learn and reason with. Ideally the language would have be well suited for:

  1. Statistical Analysis
  2. Pattern Analysis
  3. Native Array and Vector Operations
  4. Native Mathematical Functions

Note:

  1. I have no need for a GUI, and may not even get to the point of a 'move engine' but simply stop at a position evaluation engine
  2. I am not interested in speed.
  3. I am personally most comfortable with Python but I might be interested in trying something else. (though feel free to suggest this if you think it fits).
  4. I am particularly curious about how good a fit a functional language would be in this context.
share|improve this question

closed as primarily opinion-based by gnat, MichaelT, Bart van Ingen Schenau, Robert Harvey, Jim G. Oct 26 '13 at 22:54

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

    
MATLAB is what you are looking for. –  Dima Dec 21 '12 at 20:35
    
Which languages are leading chess engines implemented in? –  Aaron Kurtzhals Dec 21 '12 at 21:02
    
@AaronKurtzhals: c(++) indeed, however; I am not simply looking to reproduce the wheel w/r/t ply-depth and speed. My interest is in finding elegant and clean ways to simply evaluate positions for patterns which lead to other types of positions. –  Diabellical Dec 21 '12 at 21:27
    
Sounds pretty much like a very narrow, highly specialised DSL. You have to build your own language here, apparently. –  SK-logic Dec 22 '12 at 6:27
1  
-1 Question is vague. interesting/fun/challenging? Could be any of dozens of languages, and depends on what you like. stats/patterns/arrays/math? Again, that describes a great many languages. Per the first item in the faq, questions about what language to learn next don't really fit here, and this one seems to be in a similar vein. It's not the language so much as what you say with it. I'd suggest: think hard about how you want your program to work; try to implement it in whatever language you know best; ask for help here when you have a much more specific idea of what you want. –  Caleb Dec 22 '12 at 15:51
add comment

3 Answers

up vote 2 down vote accepted

When I read your requirements, I immediately thought of using R, like @JimmyHoffa. In addition, I have done a great deal of programming in R (and Python). I think R is ideal for this kind of work because of:

  • The large amount of statistical tools readily available. Think of Princple Component Analysis (PCA), all kinds of optimization techniques, etc. And if it is not already available there are many, many more packages available on the Comprehensive R Archive Network (CRAN), there are more than 3000 packages there. A nice way to explore these packages theme wise (e.g. econometrics, spatial data analysis, etc) is to look at the different Task Views that are available here.
  • It is open source, and freely available.
  • A large and active community which you can use to get answers to specific questions. For example, the R-help mailing list, or the [r] tag on StackOverflow.
  • All the data structures you requested (floats, matrices, arrays, tables, etc).
  • A powerful, functionally oriented, syntax that suits the data oriented nature of data analysis well. Explicit for loops are rarely needed (although they exist in the language), instead you use apply style loops. This means that you apply a function over a datastructure. For example, you can apply the mean function over the rows of a matrix to get the row means:

    apply(matrix, 2, mean) # where 2 is the dimension over which to apply
    

    this shares some similarities with list comprehensions in python.

  • Easy incorporation of C++, Fortran etc code for when you want to replace a performance critical section by compiled code.
share|improve this answer
    
thanks for taking the time to help me out with this; as per your, JimmyHoffa, and Jozefg, I will be looking into Haskell and R. Many Thanks for everyone's help. –  Diabellical Dec 22 '12 at 23:42
add comment

I think your problem scope falls exactly into the purpose of R, though I have never written or worked with R. I have heard good things about it, and would strongly suggest you start looking into it.

http://www.r-project.org/

Coming from python this will be a large shift I'm betting since it's functional, but I don't know how pure it is so it may not be too bad if it's got good multi-paradigm facilities.

If this doesn't come out to be in your opinion elegant, I would then suggest two other languages:

  • The one I find to be most elegant of any I've ever seen, Haskell, which is declarative (which sounds like what you're asking for in the way you frame your approach) and good for processing data sets.

  • And another one which facilitates declarative programming while having meta-programming facilities that has been shown to be invaluable in writing systems that analyze things with a bit more intelligence, LISP(or Scheme).

share|improve this answer
    
Having done chess and symbolic manipulation type problems in scheme and haskell. I'd say both are very well suited. Scheme is easier to pick up and has imperative abilities, but is slower and not as cool –  jozefg Dec 21 '12 at 22:36
    
@jozefcould you, for the sake of a functional-newb, explicate a bit on how the process/experience would be different by using Haskell vs extending my knowledge of Python by using NumPy etc? This is just a learning experience for me so I am all for trying something new. –  Diabellical Dec 22 '12 at 3:56
1  
@Diabellical The main difference is that functional progr is much more declarative. With Haskell you'd being learning a MH-type system, which is a very very different experience than working with python. You still have a REPL though. I'd say that learning FP if nothing else would teach you to use map/filter/list comprehensions better. Additionally since FP languages tend to be excellent with lists and you represent a chess board as well... a list, they tend to do a good job for actually manipulating the data. –  jozefg Dec 22 '12 at 12:21
    
For more info, read: programmers.stackexchange.com/questions/51712/… –  jozefg Dec 22 '12 at 12:24
    
@jozefg great. Thanks for the info. –  Diabellical Dec 22 '12 at 23:32
add comment

I'd suggest python with numpy and scipy. Since you are already familiar with python, and numpy and scipy give you the array and math functions you need.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.