Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Chinese chess ?

Author: Dann Corbit

Date: 19:06:40 07/05/02

Go up one level in this thread


On July 05, 2002 at 21:03:30, Dieter Buerssner wrote:
[snip]
>BTW. I don't totally agree, that assembler is an easy language to learn. If we
>look at the zillion adressing modes available on x86 hardware, at all the formal
>restrictions (is a memory operand allowed with this upcode? Is any register
>allowed, or just eax, ebx, ecx, edx? ...) I find this much harder to remember
>(and therefore to use) than a high level language. Not to mention, that
>assembler has no Standard library - so already printing a string on the screen
>is not trivial. One could argue, that it is in the library in C only. But the
>Standard library belongs to the language. If you start to use x87 assembly with
>floating point, many more headaches can start very soon ...

Just as one will not become a master at C or Fortran or Ada in a day, so also
one will not become a master of Assembly in a day.

If you:
1.  Make yourself a picture of the CPU with registers
2.  Print out a list of the basic instructions and what the operands are
supposed to look like

You can write a simple program in short order.  The stuff like I/O is a pest,
but you can use macros to do that.   Usually, people who do assembly stuff will
use libraries the same way that C folks do, and so it does not become so
difficult.

I think assembly is a lot more natural than a HLL.

Consider:

MOV EAX, 10 ; move 10 into the EAX register

Contrasted with

foo = 10; /* Store ten into variable foo */

Notice that the assembly instruction makes perfect sense, but the C statement is
mathematical hogwash to someone who has not seen C before.  Really, I think
something APL like would have been much more natural.  For example:

foo <- 10; /* Move 10 into storage location foo */

For the most part, the assembly language commands are natural and only 2/3 or so
of the C functions and operations seem natural (to me, at first).

Now, when you look at the complete instruction set for an INTEL CPU, it can be
daunting.  But consider the ANSI C Standard -- it will be far more difficult!

The INTEL instruction set is also better defined than the C language as far as
what will be undefined, and what can go wrong as compared to the C language.

I think a very simple Assembler like MIX or 6502 is a good way to start.  The
best thing about it is...
You will learn to yearn for an HLL! ;-) /* WHAT?!  NO multiply instruction! */

If a beginner wants to learn an HLL, probably {pardon the blasphemy} VB will be
best.  The things you make will look pretty and you can get immediate feedback.

I think probably C is one of the worst first languages (along with Pascal and
Fortran) and C++ would be better {but better not bite off too big of a piece to
start}.

The choice of language is not nearly so important as learning a methodology (or
set of methodologies) well.  Probably structured programming and OO programming
would be equally good to start with.  I think a lot of programmers never bother
to study methodologies and the programs lack direction.

The next most important thing is to understand fundamental algorithms.  If you
don't know what is going on in that department, you will invent a new wheel
every week out of stone while everyone else is driving on Pirellis.

Language is the least important.  It is nothing more than an implementation
detail.  If you have mastered a methodology and fundamental algorithms
everything you write will be beautiful.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.