Need help with compiler and language choices

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Roman Hartmann
Posts: 295
Joined: Wed Mar 08, 2006 8:29 pm

Re: Need help with compiler and language choices

Post by Roman Hartmann »

Just get this one: http://www.microsoft.com/express/Downlo ... Visual-CPP

It's quite nice IMO.

Roman
User avatar
Bo Persson
Posts: 261
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Need help with compiler and language choices

Post by Bo Persson »

Dann Corbit wrote:
Dann Corbit wrote:Writing a chess engine in assembly language today is lunacy. Don't do it.
As to your original question about engines written in assembly:
There have been several, including Rebel by Ed Schroder

I guess that eventually, everyone who chose assembly was very sorry about that choice.

The C language is more or less a portable assembly.

The big problem with assembly is that it is totally non-portable.

For instance:

MOV EAX, 0 ; Nice for 32 bit Intel CPU, but not for 64 bit registers
And another problem is that with current multi-issue processors, and multi level caches, it is totally impossible to schedule the instruction stream optimally - unless you are a computer yourself.
mhalstern
Posts: 484
Joined: Wed Nov 18, 2009 1:09 am

Re: Need help with compiler and language choices

Post by mhalstern »

I downloaded Microsoft Visual Basic 2008 Express EditionI have some followup questions:

1 - I assume this compiler can produce a stand alone executable, not needing any dll's, or registry entries.

2 - Can this produce a 64 bit executable.

3 - Can this produce code that takes advantage of more than 1 core?
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: Need help with compiler and language choices

Post by Greg Strong »

I believe it will only build .NET executables; not stand-alone EXEs. These will require the .NET Framework to be installed. Multi-threading is definitely possible. 64-bit support yes, at least mostly, but you aren't going to get blazing speed from a .NET app.

VB6 would allow you to build native EXEs, but the optimization/performance was poor, and multithreading was difficult at best.

EDIT: although you could build native EXEs, I think you still needed some DLLs for VB6 applications to function.
Last edited by Greg Strong on Tue Mar 23, 2010 12:25 am, edited 1 time in total.
Dann Corbit
Posts: 12799
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Need help with compiler and language choices

Post by Dann Corbit »

mhalstern wrote:I downloaded Microsoft Visual Basic 2008 Express EditionI have some followup questions:

1 - I assume this compiler can produce a stand alone executable, not needing any dll's, or registry entries.
You will need the .NET runtime for which the application was compiled IF the target machine does not already have it installed.

2 - Can this produce a 64 bit executable.
Yes, also 32 bit executables and also an executable that will switch mode to the machine's architecture.

3 - Can this produce code that takes advantage of more than 1 core?
Yes, you can create threaded applications with .NET.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Need help with compiler and language choices

Post by Don »

Dann Corbit wrote:
Dann Corbit wrote:Writing a chess engine in assembly language today is lunacy. Don't do it.
As to your original question about engines written in assembly:
There have been several, including Rebel by Ed Schroder
Rexchess was assembly language - the GUI was turbo pascal.
Early Fritz was assembly.


I guess that eventually, everyone who chose assembly was very sorry about that choice.
I enjoyed it very much and was never sorry. The issue with assembly is that it takes a lot of skill to beat out a good C compiler and what you mention, that it's not portable across processors. In other words you will probably have a faster program if you write in C. Of course if you really know what you are doing assembly will give you the fastest program - but you really have to know your stuff.

The C language is more or less a portable assembly.

The big problem with assembly is that it is totally non-portable.

For instance:

MOV EAX, 0 ; Nice for 32 bit Intel CPU, but not for 64 bit registers
mhalstern
Posts: 484
Joined: Wed Nov 18, 2009 1:09 am

Re: Need help with compiler and language choices

Post by mhalstern »

Don,

With Rexchess, what did you use to get make an executable from the assembler code? What tools are available for the windows 7 64 bit envrionment?

I'd like to play around with assembler.

Thanks
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: Need help with compiler and language choices

Post by Greg Strong »

There's a whole spectrum from most primitave to most abstract... Most chess programs are C or C++. When you asked, the recomendations were in the C, C++, C# range. You then went even further in the abstract direction and asked about Visual Basic. Now you're going all the way in the other direction and asking about assembly? Don't get me wrong, I'm not trying to disuade you from any well-informed choice, but why on earth would you want to go all the way from one extreme to the other? Assembly would be incredibly hard to write, hard to debug, not portable, and given how strong compiler optimization is these days, it's not even clear that such code would be faster. May I respectfully suggest that you consider C, C++, or C# instead. Otherwise, you'll need at least a year of full-time dedication to even get to the point of a fully-functioning chess program, and it won't be portable.

On the other hand, it's a hobby, and if that's what's fun for you, I wouldn't want to discourage you. Just want you to be realistic about what you're getting into ...
mhalstern
Posts: 484
Joined: Wed Nov 18, 2009 1:09 am

Re: Need help with compiler and language choices

Post by mhalstern »

Maybe I can take this a step further and write all of the code in pure binary - serveral thousand lines of 0's and 1's.

In all seriousness, I'm probably going to write the first engine in VB. I am however interested in playing around with alternatives. You didn't answer my last question: How does one create an executable from assembler instructions?
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: Need help with compiler and language choices

Post by Greg Strong »

Sorry, didn't mean to evade, simply don't have a good answer. In fact, I looked into this myself and found answers surprisingly hard to find. Microsoft Macro Assembler (MSAM) seems to be the only real tool and Microsoft themselves don't even really advertise it. Assembly has become sort of a "black art." Now, you can do C/C++ with in-line assembly, but even that is not permitted in 64-bit with the Microsoft compilers, but it is with the Intel compilers. And Intel offers theirs for free for Linux, so if you really want to go this route, your choices, as far as I can tell, is MSAM, or Intel C for Linux with in-line assembly.