What are some good resources for writing a chess engine? [closed] - resources

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm interested in writing a chess engine (mostly as a learning exercise) and would be interested in any resources that people know of that could be of interest or use, anything really: Papers, Books, Theory, Tutorials, anything that could be useful.

From my archives:
This is a useful chess programming wiki.
This is a simple introduction to chess programming.
This is a (free) book on chess algorithms.
This contains several easy step-by-step YouTube tutorial series' ranging from beginner to advanced level.
This is a more advanced introduction.
This is Adam Berent's interesting computer chess blog.
This is a good analysis of MTD(f), an interesting search algorithm.
This is a good guide to validation of move generation.
This is lots of good information on the Rebel chess engine.
This is lots of good information on the Dark Thought chess engine.
Good information and source code for the Monsoon chess engine.
These are more notes on chess programming.
A reasonable introduction to rotated bitboards.
A reasonable introduction to magic bitboards.
A reasonable introduction to late move reductions.
A look at null-move pruning.
A collection of position sets for testing purposes.
Here is an old report from 2 students who wrote a chess program.
A bunch of miscellaneous chess programming links.
Finally, here is Wikipedia's take on computer chess.

When creating my chess engine I spent months trying to collect good resources that describe some of the harder aspects of creating a chess game. Here is a list of the ones I found most useful:
Chess Programming by François Dominic Laramée
This is the article that got me into computer chess, It is a great overview of how computers play chess. It is extremely easy to read and it will introduce you to all the terms and keywords.
http://www.gamedev.net/page/resources/_/technical/artificial-intelligence/chess-programming-part-i-getting-started-r1014
Computer chess wiki, this has really expanded over the last few months. It is an excellent resource for reference material.
https://www.chessprogramming.org/Main_Page
Louis Kessler's Computer Chess Links
Once you go through the above resources the remainder can be found at the following links page.
http://www.lkessler.com/cclinks.shtml
Last but not least I write a Computer Chess Blog that takes you through all the steps of writing a chess engine in C# from scratch, it includes a computer chess links section and a chess game starter kit.
http://www.chessbin.com
Adam Berent

I have joined the same league of Paul Wicks(above), I too want to write a chess engine for my own learning sake's, only constraint is my day job(which is to work on boring web services and stuff..) but its worth the pain.
I decided to build it using layer-by-layer approach.
I'm almost through with the multi-player part i.e. (HUMAN vs HUMAN).
Once I'm done with this, I would love to incorporate the AI layer to support (COMPUTER vs HUMAN) playing scheme.This is the part that I'm most worried about, I have found very nice help tips here in this thread, a big thanks to all of you.
Currently the language that I'm well versed with is Java, in case there's a performance hit
then I might port it to C++.

This is basically in the field of Artificial Intelligence (AI).
The most common way to make a computer "think" in chess game is using the mini-max method where computer "think" by analyzing the results from making different moves ahead of time from the current state.
The "goodness" of results from different moves can be determine from many criteria such as score, number of enemies left, winning state, for example. For instance, if you move the player to the right and you win the game, that's a very good state. But if you move it to the left you get nothing. It is reasonable to move to the right. This function that define "goodness" is usually called Heuristic Function.
This process is done recursively for many turns. The greater the number of turns, the more time you will need. And the greater the number of turns, the more intelligent your software is. Thinking ahead in only one turn may only result in greedy selection. Intelligent chess software has great heuristic function and think ahead in many turns.
ps. There are some details of mini-max algorithm I didn't explain here but this should cover the basic idea.

Related

Real world Haskell programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Having been an imperative developer for some years now, I had never had the urge to learn functional programming.
A couple months ago at last I decided to learn Haskell. It's quite a cool language, but I'm puzzled about how an event driven real app would be programmed in such a language. Do you know of a good tutorial about it?
Note: When I say "real app" I'm not talking of a real world, production ready app. I just mean a little sample app, just to get the grasp of it. I think something like a simplified version of the windows caculator would be great, and then perhaps something a bit more complex.
When you say "real world" examples you are presumably thinking about problems that are inherently sequential or stateful or do lots of I/O, right?
So, how about games?
Frag is a Quake clone, implemented for an undergraduate thesis (Functional Programming and 3D Games, Mun Hon Cheong, 2005). Here's a video of it in action.
Super Monao Bros. (formerly known as Super Nario Bros.) is, well, you can probably figure out which game it is a clone of. (This is the author's English language weblog.)
Purely Functional Retrogames is a 4-part series of blog articles about how to write games in a purely functional language, explained using Pacman as the example. (Part 2, Part 3, Part 4.)
Or, what about an X Window Manager, an extensible Emacs clone text editor or an IDE?
Then, there is the book, which even has your question already in the title: Real World Haskell and which is also available for free!
Another thing you might want to look at, is Functional Reactive Programming. (It is used in Frag, for example.) The interesting thing about FRP is that it allows you to look at the problem of, say, GUI programming from a very different angle. If you read the GUI chapter in the RWH book, you will see that it talks about how you can write a GUI application just like in C, only better. FRP OTOH allows you to write it in a totally different way that wouldn't even be possible in C.
A lot of times (I'm not saying that this is the case in your question, but it is a recurring pattern) when someone says "but can Haskell be used in the real world", what they are really saying is "I know how to do this in C, and in Haskell I cannot do it in exactly the same way, therefore it must be impossible in Haskell, therefore Haskell is not ready for the real world". But what they are missing out on, is that there might be a totally different and much better way to solve the problem. (It's like saying "Erlang doesn't have threads, therefore it cannot possibly be used to implement concurrent systems.") And FRP is just one example.
For a lightning talk today I have assembled this list of show-case Haskell applications, deliberately excluding anything that only targets programmers:
darcs (since 2002, 35 000 loc): Distributed
version control system with an innovative focus on changes instead
of states.
xmonad (since 2007, 30000 loc): Well known
tiling window manager with a huge library of layout and other
plugins. Made it into the list despite its configuration file being
a Haskell file.
hledger (since 2007, 9000 loc): Text-file
based double-ledger accounting tool, a clone of
ledger.
Raincat (since 2008, 2000 loc):
Platform game with a cat that does not want to get wet.
arbtt (since 2009, 2000 loc): My
automatic rule-based time tracker. Made it into the list as a
shameless plug; probably not that popular. It has now a proper web
page contributed by Waldir Pimenta.
detexify (since 2010, 500 loc): The
back end of the very useful LaTeX character command finder is
written in Haskell.
git-annex (since 2010, 28 000
loc): Manages your files and their location, a mixture of dropbox
and git. Written by famous Joey Hess, who made a living from it via
kickstarter
He is currently running a second round of
funding!
Nikki and the Robots (since 2010, 18 000
loc): Platform game with Nikki and, well, his robots. It was
produced as a commercial independent game and sold via a
pay-what-you-like scheme, but the company unfortunately closed down.
hoodle (since 2011, 13 000 loc): A
note-taking and PDF annotation software like
xournal.
Chordify (since 2012, ? loc): Analyses
music, e.g. from a YouTube video, and calculates the corresponding
guitar chords. Closed software, but supposedly written in Haskell.
(Also featured on my blog, and on the slides of the talk, with nice representative pictures of each program.)
xmonad is event driven (literally). It has a listener loop that wakes up on events, modifying an internal state modelling the X server, which is then rendered to the screen.
http://xmonad.org
I once found this irc bot written in haskell:
http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot
Here are some links as you requested.
This one explains a lot of things that doesn't 'make sense' to an imperative programmer about Haskell
Haskell Tutorial for C Programmers
This one is a very good easy to follow tutorial
Learn You a Haskell for Great Good
Raytracer written in Haskell
Haskell Raytracer
You can download Glasgow Haskell Compiler from here.
GHC
you should check out Real World Haskell. The book is freely available and shows how Haskell can be applied to real world problems. I wouldn't call it a tutorial, tho, as it is much more comprehensive.
Check out functional reactive programming.

High-level programming language for music composition [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I would like to write an interactive song. It would contain state and logic. A listener/user should be able to modify some state vars using a GUI or a MIDI interface. Listener accessible vars don't have to directly represent tempo, pitch or any other music property. They would rather represent values that logic would process in order to make changes to the song.
Do I have to write such platform myself or something fitting my imagination already exists?
Look at cSounds and PureData.
If you are happy to use Java, check out JFugue.
I have tried PureData, CSound and SuperCollider.
CSound is very cumbersome to program in, and has had severe stability issues for my requirements (24bit/96kHz realtime low latency linux) in version 4.
PureData is graphical, which makes it even harder to keep code neat and tidy then with text files. Composing is a pain because you have to build your own composition GUI, which can be powerful, but as long as I'm my only user I find it's just faster to use text.
The winner hands down is SuperCollider, because it is a smalltalk inspired object oriented language which is quite pleasant to work with. It is split into an OSC controlled sound server, and the client language. I can recommend the sound synthesis server and using the language to create instruments without reservation for its excellent stability, great flexibility and incredible power. I've used it live on stage and the performance is incredibly good.
The score creation language suffers from many-hands syndrome; in lack of recent clear leadership there are too many ways to do too many things with too many limitations, but it is still better than CSound because at least you can use reasonable high level structures.
Still looking for a composition language that just gets it right.
Have a look at Strasheela:
It's a composition system based on the programming language Oz. Learning Oz isn't easy, as it it combines the functional and the logic programming paradigm. However if you liked the SICP book, then you will probably like it too.
Strasheela treats music composition as a Constraint Statisfaction Problem (CSP), and seeks "solutions" for it. It means that the music style is defined as mathematical constraints on integer numbers (finite domain), that must be statisfied, and the built-in constraint solving system computes the solutions "automatically".
P.S.: I cannot program in Oz, but I'm on my way of learning it.
See High level languages for Computer Music and Programming Languages used for music for help.
I am not sure if it covers what you are after for, but have a look at Java Sound API. For a FAQ about what it can do see here. The benefits are that is already bundled in the SDK and JRE and that is cross platform. Also, you could build the GUI using any Java toolkit.
If it weren't for the interactive bits, I'd suggest looking at Haskore or Nyquist, both effectively being DSLs for music generation.
Definitely take a look at Alex McLean's livecoding demos, though. It's more flexible and interactive as you can possibly imagine, using SuperCollider through OpenSoundControl.
Answer is for .NET:
I found something, checkout NAudio by Mark Heath, a great .NET music library I would say it should be contained in the BCL.
midi-dot-net is another great C# project by Tom Lokovic.
For music interaction, PureData, Max/MSP and OpenMusic (these two last are from IRCAM) are the best. PureData is freeware. Google them!
I don't really get what you want to do, but here is a list of some CL music software, both for composition and cognition: http://www.cliki.net/Music
You're looking for an Audio Programming Language. Another option you should consider is Processing - used by many artists and musicians for this type of work.
-Adam
Its a shame that none said about Chuck................
Chuck is a programming language that is specifically built for music/audio generation and composition.
You can download Chuck at http://chuck.stanford.edu
its a lot easier to use,and is a lot familiar to c,c++,java etc,however its easier to learn too.You can find at Coursera about chuck for free from California arts university,link here.

Computer Graphics: Raytracing and Programming 3D Renders

I've noticed that a number of top universities are offering courses where students are taught subjects relating to Computer Graphics for their CS majors. Sadly this is something not offered by my university and something I would really like to get into sometime in the next couple of years.
A couple of the projects I've found from some universities are great, although I'm mostly interested in two things:
Raytracing:
I want to write a Raytracer within the next two years. What do I need to know? I'm not a fantastic programmer yet (Java, C and Prolog are my main languages as of today) but I'm slowly learning every day. Also, my Math background isn't all that great, so any pointers on books to read or advice on writing such a program would be fantastic. I tend to pick these things up pretty quickly so feel free to chuck references at me.
Programming 3D Rendered Models
I've looked at a couple of projects where students have developed models and used them in games. I've made a couple of 2D games with raster images but have never worked with 3D models. What would I need to learn in regards to programming these models? If it helps I used to be okay with 3D Studio Max and Cinema4D (although every single course seems to use Maya), but haven't touched it in about four years.
Sorry for posting such vague and, let's be honest, stupid questions. It's just something I've wanted to do for a while and something that'd be good as a large project for me to develop in my own time.
Related Questions
Literature and Tutorials for Writing a Ray Tracer
I can recommend pbrt, it's a book and a physically-based renderer used to teach computer science graduates. The description of the maths used is nice and clear, and since it is written in the 'literate programming' you can see the appropriate code (in C++) too.
The book "Computer Graphics: Principles and Practice" (known in the Computer Graphics circles as the "Foley-VanDam") is the basic for most computer graphics courses, and it covers the topic of implementing a ray-tracer in much detail. It is quite dated, but it's still the best, afaik, and the basic principles remain the same.
I also second the recommendation for Eric Lengyel's Mathematics for 3D Game Programming and Computer Graphics. It's not as thorough, but it's a wonderful review of the math basics you need for 3D programming, it has very useful summaries at the end of each chapter, and it's written in an approachable, not too scary way.
In addition, you'll probably want some OpenGL or DirectX basics. It's easier to start working with a 3D API, then learn the underlying maths than the opposite (in my opinion), but both options are possible. Just look for OpenGL on SO and you should find a couple of good references as well.
The 2000 ICFP Programming Contest asked participants to build a ray tracer in three days. They have a good specification for a simple ray tracer, and you can get code for the winning entries and some other entries as well. There were entries in a large number of different programming languages. This might be a nice way for you to get started.
The briefest useful answer I can give is that most of the important algorithms can be found in Real-Time Rendering by Tomas Akenine-Möller, Eric Haines, and Naty Hoffman, and the bibliography at the end has references to the necessary maths. Their website has a recommended reading list as well.
The most useful math book I've read on the subject is Eric Lengyel's Mathematics for 3D Game Programming and Computer Graphics. The maths you need most are geometry (obviously) and linear algebra (for dealing with all the matrices).
I took such a class last year, and I believe that the class was wonderful for forcing students to learn the math behind the computer graphics - not just the commands for making a computer do what you want.
My professor has a site located here and it has his lecture notes and problem sets that you can take a look through.
Our final project was indeed a raytracer, but once you know the mathematics behind it, coding (an inefficient one) is trivial.
For a mathematical introduction into these topics, see
http://graphics.idav.ucdavis.edu/education/GraphicsNotes/homepage.html
Check http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-1-writing-a-simple-raytracer/
This is a very good place to learn about ray tracing and rendering in general.

About "AUTOMATIC TEXT SUMMARIZER (lingustic based)" [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am having "AUTOMATIC TEXT SUMMARIZER (linguistic approach)" as my final year project. I have collected enough research papers and gone through them. Still I am not very clear about the 'how-to-go-for-it' thing. Basically I found "AUTOMATIC TEXT SUMMARIZER (statistical based)" and found that it is much easier compared to my project. My project guide told me not to opt this (statistical based) and to go for linguistic based.
Anyone who has ever worked upon or even heard of this sort of project would be knowing that summarizing any document means nothing but SCORING each sentence (by some approach involving some specific algos) and then selecting sentences having score more than threshold score. Now the most difficult part of this project is choosing the appropriate algorithm for scoring and later implementing it.
I have moderate programming skills and would like to code in JAVA (because there I'll get lots of APIs resulting in lesser overheads). Now I want to know that for my project, what should be my approach and algos used. Also how to implement them.
Using Lexical Chains for Text Summarization (Microsoft Research)
An analysis of different algorithms: DasMartins.2007
Most important part in the doc:
• Nenkova (2005) analyzes that no system
could beat the baseline with statistical
significance
• Striking result!
Note there are 2 different nuances to the liguistic approach:
Linguistic rating system (all clear here)
Linguistic generation (rewrites sentences to build the summary)
Automatic Summarization is a pretty complex area - try to get your java skills first in order as well as your understanding of statistical NLP which uses machine learning. You can then work through building something of substance. Evaluate your solution and make sure you have concretely defined your measurement variables and how you went about your evaluation. Otherwise, your project is doomed to failure. This is generally considered a high risk project for final year undergraduate students as they often are unable to get the principles right and then implement it in a way that is not right either and then their evaluation measures are all ill defined and don't reflect on their own work clearly. My advice would be to focus on one area rather then many in summarization as you can have single and multi document summaries. The more varied you make your project the less likely hold of you receiving a good mark. Keep it focused and in depth. Evaluate other peoples work then the process you decided to take and outcomes of that.
Readings:
-Jurafsky book on NLP there is a back section on summarization and QA.
-Advances in Text Summarization by inderjeet mani is really good
Understand what things like term weighting, centroid based summarization, log-likelihood ratio, coherence relations, sentence simplification, maximum marginal relevance, redundancy, and what a focused summary actually is.
You can attempt it using a supervised or an unsupervised approach as well as a hybrid.
Linguistic is a safer option that is why you have been advised to take that approach.
Try attempting it linguistically then build statistical on to hybridize your solution.
Use it as an exercise to learn the theory and practical implication of the algorithms as well as build on your knowledge. As you will no doubt have to explain and defend your project to the judging panel.
If you really have read those research papers and research books you probably know what is known. Now it is up to you to implement the knowledge of those research papers and research books in a Java application. Or you could expand the human knowledge by doing some innovation/invention. If you do expand human knowledge you have become a true scientist.
Please make your question more specific, in these two main areas:
Project definition: What is the goal of your project?
Is the input unit a single document? A list of documents?
Do you intend your program to use machine learning?
What is the output?
How will you measure success?
Your background knowledge: You intend to use linguistic rather than statistical methods.
Do you have background in parsing natural language? In semantic representation?
I think some of these questions are tough. I am asking them because I spent too much time trying to answer similar questions in the course of my studies. Once you get these sorted out, I may be able to give you some pointers. Mani's "Automatic Summarization" looks like a good start, at least the introductory chapters.
The University of Sheffield did some work on automatic email summarising as part of the EU FASiL project a few years back.

How do I programmatically calculate Poker Odds? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
Improve this question
I'm trying to write a simple game/utility to calculate poker odds. I know there's plenty of resources that talk about the formulas to do so, but I guess I'm having trouble translating that to code. Particularly, I'm interested in Texas Hold-em ...
I understand that there are several different approaches, one being that you can calculate the odds that you will draw some hand based on the cards you can see. The other approach is calculating the odds that you will win a certain hand. The second approach seems much more complex as you'd have to enter more data (how many players, etc.)
I'm not asking that you write it for me, but some nudges in the right direction would help :-)
Here are some links to articles, which could help as starting points: Poker Logic in C# and Fast, Texas Holdem Hand Evaluation and Analysis
"This code snippet will let you calculate poker probabilities the hard way, using C# and .NET."
The theoretical fundamentals are given in this Wikipedia article about Poker Probabilities and in this excellent statistical tutorial.
An example of a complete project written in Objective-C, Java, C/C++ or Python is found at SpecialKEval. Further links and reading can be found therein.
Monte carlo simulation is a common approach to get the odds calculation for poker hands. There are plenty of examples of implementing this kind of simulation for holdem on the net.
http://www.codeproject.com/KB/game/MoreTexasHoldemAnalysis1.aspx
Take a look at pokersource if you have reasonably strong C abilities. It's not simple, I'm afraid, but some of the things you're looking for are complex. The poker-eval program that uses the library will probably do much of what you want if you can get the input format correct (not easy either). Sites such as this one or this also use this library AFAIK.
Still, it could be worse, you could be wanting to calculate something tricky like Omaha Hi-lo...
Pokersource and the statistical articles are not bad suggestions. But this is really best done with a Monte Carlo simulation, a useful, simple, and powerful approach to this type of difficult problem.
It works equally well with Omaha Hi-lo as it does with Hold'em
Complete source code for Texas hold'em poker game evaluator can be found here:
http://www.advancedmcode.org/poker-predictor.html
It is built for matlab, the GUI id m-coded but the computational engine is c++.
It allows for odds and probability calculation. It can deal, on my 2.4Ghz laptop, with a 100000 10 players game computation in 0,3 seconds.
An accurate real time computer:-)
Have a look here as well:
http://specialk-coding.blogspot.com/2010/04/texas-holdem-7-card-evaluator_23.html
Monte Carlo simulation is often slower than the good exact evaluators.
We may also be able use combinatorics, calculating the odds with combinations and the number of ways each combination can appear. This way we don't have to iterate over all the possible hands.

Resources