Message-ID: <31F1D24A.20DA@3-cities.com>
Date: Sat, 20 Jul 1996 23:46:34 -0700
From: Travis Griggs <tkc@3-cities.com>
Reply-To: tkc@3-cities.com
X-Mailer: Mozilla 2.01 (Macintosh; U; PPC)
MIME-Version: 1.0
Newsgroups: comp.lang.smalltalk
Subject: Re: Encoding a Chess position
References: <4snb94$8or@harbinger.cc.monash.edu.au>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bigtca408.3-cities.com
Lines: 51
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!newsflash.concordia.ca!news.nstn.ca!ott.istar!istar.net!van.istar!west.istar!uniserve!oronet!news.sprintlink.net!news-stk-11.sprintlink.net!news.texas.net!news.kei.com!newsfeed.internetmci.com!netnews.nwnet.net!204.203.224.159!

Danny H Cron wrote:
> 
> Using Visual Works 2.0
> 
> I'm writing a general game playing program in smalltalk, and my current
> implementation is very memory intensive.  I had represented a board
> position as a two dimentional array, where each location could either
> be #empty, or a piece.  Each piece knew the position it was in, its
> location on the board and whose side it was on.
> 
> What I want to do now, is to have a more compact representation of a
> position.  When I looked into smallIntegers - which I hoped tha I
> would be able to use in order to perform bit manipulation - I discovered
> that there seems to only be 29 bits in a small integer before it
> converts into a large integer.  (I was kind of expecting the standard
> 32 bits)
> 
> (1 bitShift: 28) class
>  SmallInteger
> 
> (1 bitShift: 29) class
>  LargePositiveInteger
> 
> Now I haven't look very far, so maybe I got this wrong but
> in any case I was wondering if someone could suggest an efficient way
> to represent, say a chess board.  For the moment you only need worry
> about the actually chess position, no need to include castling, en-
> passon, or draw states.
> 
> I was thinking of something simple like calculating the number of
> different possible states in a location.  Empty + 2 x (Pawn, Knight,
> Bishop, Rook, Queen, King) = 13.  Then round this number up to the
> next power of 2.  2^4 = 16.  And then use 4 bits for each location.
> However this doesn't divide very evenly into 29 bits.
> 
> Suggestions?   Corrections?
> 
> Danny.
> 
Everybody's thrown their two or three or four bits in on this one... :) 
I once heard of some students that were playing with chess boards in 
Smalltalk. I thought they had a novel approach (allthough for all I know 
this could be industry standard in chess circles?) of using bitmaps to 
represent the positions of various pieces, and bitmaps to represent the 
the movement potential for various pieces. They then used the BitBlt 
stuff to iterate through potential patterns, thus rapidly eliminating 
moves that were not feasible or a dead end. Just a thought...

-- 
Travis Griggs
tkc@3-cities.com
(509) 943-4210
