Re: attempting an actual game...
- From: Gerry Quinn <gerryq@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Dec 2005 14:46:51 -0000
In article <414dc$4396eec6$ca83a645$23792@xxxxxxxxxx>, cr88192
@NOSPAM.hotmail.com says...
> "Gerry Quinn" <gerryq@xxxxxxxxxxxxxxxxxxx> wrote in message
> > It was what you posted in order to show how your coding abilities were
> > too great to be wasted on Tetris. And yet it was made utterly crippled
> > and inflexible by the absurd decision to use a bit array for square
> > colours, probably in furtherance of some half-baked idea of efficiency
> > (like your re-inventions of the zip file etc.).
> no, I figured one would use a bit array as that would probably be convinient
> for this sort of use. yeah, in retrospect, bytes would probably make more
> sense, as then one has 8 bits in which to store a color and a few flags or
> similar.
>
> or is this missing the point?...
Yes, it is TOTALLY missing the point. If you want to store just a
colour, bytes will do though ints are the natural choice when space is
not as a premium. Bytes are theoretically adequate, but invite integer
promotion errors.
If you want to store flags as well, putting them in the same memory
address is simply poor practice, creating extra complication and
obscurity for no gain whatsoever.
As Philippa says, you should abstract it. However, I would not tell
anyone exactly how to start off a Tetris in detail, either in prototype
or for evolution into a final version. Using a 2D int (or, if you
must, byte or short array) is okay. Sticking to a GetCol(x,y) function
is fine. Creating a Cell class that currently has just a colour is
fine, but it's easy to get over-elaborate. I would actually settle for
an int array, on the basis that if I want to change it, it will happen
before the program gets too complicated for this to be difficult.
(Obviously only the game logic class will have direct access to this
array.)
(I once started with typedef int Cell, with a view to making a Cell
class later. That was definitely overelaborate, though it did no harm,
as it could revert to the int array option.)
> if anything, I will probably continue in the current direction and see what
> I can do, regardless of what others think.
With all due respect, it's obvious to everyone what you can do if you
comtinue in the current direction. I.E. diddley squat.
Change direction and you may eventually complete a game.
Of course you could prove us wrong by delivering a working Tetris by
tomorrow.
- Gerry Quinn
.
- Follow-Ups:
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- References:
- attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Erik Max Francis
- Re: attempting an actual game...
- From: zircher
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Raghar
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Gerry Quinn
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Erik Max Francis
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Erik Max Francis
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Gerry Quinn
- Re: attempting an actual game...
- From: cr88192
- Re: attempting an actual game...
- From: Gerry Quinn
- Re: attempting an actual game...
- From: cr88192
- attempting an actual game...
- Prev by Date: Re: attempting an actual game...
- Next by Date: Re: attempting an actual game...
- Previous by thread: Re: attempting an actual game...
- Next by thread: Re: attempting an actual game...
- Index(es):
Relevant Pages
|