h a l f b a k e r y
You gonna finish that?
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
or get an account
I note that there is such a thing as an op code in x86 CPUs which
returns the approximate value of pi. If this is calculated using some
kind of algorithm
rather than, as I suspect, just hanging out stored somewhere on the
CPU itself, it would be a nice achievement. GPUs are clearly capable
doing clever stuff quickly too.
In 1982, a ZX81 program was published which played chess in 672
bytes or thereabouts of Z80 machine code. This is not vastly
and may even be less complex than, calculating pi to a certain
of places or doing 3-D graphics.
It ought to be possible to furnish a CPU with the ability to play chess
putting a particular op code in its instruction set. This could operate
one of two ways. It could either interpret the next four bytes as
algebraic notation for a chess move and plonk a four byte value in a
register, memory location or on a stack which represented its
similarly, or it could use a sixty-four nibble area of memory
representing a chess board and modify it accordingly.
This would be cheating of course, but it would also break all records,
probably permanently, for short chess programs, as it would be
in one byte, excluding operands. Fanciness could ensue as usual in
form of pretty raytraced boards or whatever, but the core of the
program would be just that single byte.
I presume 1K chess was very poor, but it could still be used as the
basis of possible moves which could then be improved. Moreover,
doing this might furnish the CPU with other facilities in the
which would enable it to do other things very efficiently such as play
draughts relatively simply. It would also be humongously fast.
I want it implemented in hardware rather than microcode, and the
of the instruction set could be RISC if you like to compensate.
Portable Game Notation, used by lots of chess programs as an input/output/serialisation format. [zen_tom, Jan 18 2017]
Wikipedia: Shannon Number
An estimate of the size of the permutation space for chess. [zen_tom, Jan 18 2017]
Wikipedia: Chess Board Representation
[zen_tom, Jan 18 2017]
||There ought to be some standard mapping of the
permutations of positions of pieces on a chessboard to a
value - if this can be identified, or codefied in some way, it
might act as a convenient input output device, i.e. feed in
the number representing the current board-state, and the
operation would return a value corresponding to the state
after the move. This number is likely to be rather large, and
probably wouldn't fit into 4 bytes (slight understatement -
see Shannon Number -
||Sorry, talking out of my hat here! I was starting to think,
"How does *anyone* represent a chessgame?" and there are
of course lots of simpler arrangements e.g. FEN.
||An alternative would be to use PGN, but that's pretty
verbose, and could end up being rather large too.
||The thing is, there's no need for a computer to be able to make a poor chess move at lightning speed. Either it's playing against a human, in which case it has millions of full cycles before the human can even recognize what move was made, or it's playing against another machine, in which case moves from the 1000 byte program won't teach us anything no matter how many there are.
||Once you can operate with the number of atoms in the
universe (or the neighborhood thereof), chess is just tic-tac-
||It shouildn't surprise me that there's an internal notation,
but thanks for that. The reason I thought in terms of
nybbles is that to my mind there seem to be thirteen
possibilities: one of six possible pieces of each colour or
an empty square. If there's a standard, compact way of
doing that, fine - rather like the IEEE representation of
floating point numbers, if that's what it is.
||You could indeed argue that there's no need for this,
which to me is not the same as not wanting to do it
because the idea is "there". Having said that, I can see
positive fallout from it. The hardware which made this
possible would make other things possible too if portions
of it were available for those other uses, and it's even
conceivable that the whole architecture could be
optimised for chess. For instance, maybe the data bus
could be 256 bits which could be used as a chessboard,
accessible in eight 32-bit words, each representing a row.
||If a design decision is useful for other purposes there's no need to discuss chess to decide whether to implement it. If you just want to propose arbitrary solutions that may come in handy other ways any arbitrary solution will do. The processor best suited to running a sewing machine, or op codes for finding rhyming words.
||I've implemented chess engines multiple times, including
on mobile phones in those days when efficiency still
mattered on mobile phones.
||Ultimately the strength of a typical chess program (i.e.
not one designed to beat the world champion, but more
so for a subway ride) is in the size of the opening book,
and therefore the density of describing positions (so as to
store a larger opening book) is of some meaningful value.
||[Voice], computers are to my mind general purpose
machines with unanticipated applications. As they are
now, they seem to be primarily devices which do Boolean
algebra which has been extended to arithmetic. This has
taken them in unexpected directions and it's easier to get
them to do some things than others. The things it's
easier to do with a chess-oriented computer might turn
out to be things which are harder for an arithmetic-
oriented one to do, or of course there might be some
mathematical proof that that's not so. It might also be
harder to do other things, but then this is a generalised
computer as well as a chess one.
||[theircompetitor], would it help at all if there was a bad
chess algorithm churning out some poor moves very
quickly which could then be assessed by a better one?
||I also now really, really want to know how the ZX81
program worked. I've been assuming up until now that it
was just a computer representation of a chessboard
which two players could use, but obviously I was wrong.
||[nineteenthly] sure, in the "Shall We Play A Game" mode
(i.e. testing all possibilities, where all is larger than the # of
atoms in the universe, at least until we figure out the dark
||I think you would need more than a single instruction, at the very least you would need another to reset the board.
||Many CPUs have opcodes that correspond directly to dedicated hardware, for instance a shift operation might invoke a barrel shifter, a dedicated circuit just for doing multiple shifts. Also, some CPUs take many cycles to complete single instructions.
||So, just grab an existing chess computer, and plug it into your CPU as a dedicated hardware chess circuit.
||That's allegedly similar to the way they used to add an arithmetic co-
processor to CP/M machines by sticking a calculator chip in there. It
seems quite inelegant and it'd be pretty slow.
||If it was done via a data structure representing the board, only one
instruction would be needed. The board could be initialized on reset
and future games could be set up through procedures. However,
abandoning a game would be messy.