<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=US-ASCII">
<META content="MSHTML 6.00.6001.18099" name=GENERATOR></HEAD>
<BODY id=role_body style="FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: Arial" 
bottomMargin=7 leftMargin=7 topMargin=7 rightMargin=7><FONT id=role_document 
face=Arial color=#000000 size=2>
<DIV>I have had a curiosity about Smalltalk for many years so I recently 
downloaded and installed Squeak. That's when the trouble began. I have written 
applications that deal bridge hands and either display the hands on screen or 
save them in a couple of different formats. I originally wrote the 'words' in 
Forth. I later tried Ruby and rewrote most of the programs in Ruby. I did it as 
a learning experience. I sat out to do the same thing in Squeak, again as a 
learning experience, but have made virtually no progress. I create the class 
'Bridge' with the subclass of dealer. I try to initialize by filling a byteArray 
with 52 numbers, 0 through 51. I tended to create additional methods to shuffle 
and deal the cards to four more byte arrays named north, east, south, and west. 
Eventually I will need another method to "stack the deck." I will also need a 
counter to keep track of the deal number.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I can't get started, and I mean zero progress, because I can't create and 
load deck. It seems like the documentation is never quit up to date. I read 
about curly braces and tried deck := {0. 1. 2. ... }. When I try to accept it, 
first deck is questioned and then after deck I get something about not expecting 
anything else.</DIV>
<DIV>I know there is a word 'asByteArray:' and I assume a number would specify 
the size of the array but nowhere can I find anything about the order in which 
the information should be provided. I tried deck asByteArray: 52 but I don't 
know if it worked. If it did work, how do I load the bytes into it? How do I 
look at a byte in a particular location in the array? Can I remove a byte from 
position x and/or insert a byte at position y and everything moves to 
accommodate the change.</DIV>
<DIV>&nbsp;</DIV>
<DIV>In Forth and Ruby, I was able to store the hands as a 2D bit array, 4 suits 
and 13 bits. If the card was present the bit was set. When I dealt the cards, 
the appropriate bits were set.. This worked really well. The suits came out 
already sorted. The strength of a suit turned out to be related to the value 
stored for the suit. The number of cards in the suit could be found by counting 
set bits. I have yet to find bit-manipulating words in Squeak/Smalltalk.</DIV>
<DIV>&nbsp;</DIV>
<DIV>As an aside, the least number of bits that must be used to store a complete 
deal is 104 or 13 bytes. The bits are arranged in 52 2-bit groups. The position 
in the array represents the value of the card and the bits determine which hands 
gets the card represented by that position. When you shuffle the 2-bit groups 
must be kept in tact. I could easily do this in Forth but could not do it in 
Ruby. If you are going to save a few million hands, it is nice to be able to do 
so in this most compact form.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If I could just figure out where to find the answers to these beginner 
question, I would really appreciate it. It would also be nice if I could see 
some examples of these methods.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Charlie</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT><BR><BR><BR><DIV><FONT style="color: black; font: normal 10pt ARIAL, SAN-SERIF;"><HR style="MARGIN-TOP: 10px">It's only a deal if it's where <I>you</I> want to go. Find your travel deal <A title="http://information.travel.aol.com/deals?ncid=aoltrv00050000000047" href="http://information.travel.aol.com/deals?ncid=aoltrv00050000000047" target="_blank"><B>here</B></A>.</FONT></DIV></BODY></HTML>