Re: attempting an actual game...



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
.



Relevant Pages

  • Re: How to calculate largest number in sub-range?
    ... Well, yes, you can prepare an array, obviously. ... using a 1-based indexing system, but I'm going to hack that to 0 because ... int getmax) ... And of course each cell ...
    (comp.programming)
  • Re: sorting an array of three kinds of stones
    ... > Each cell of the array contains one stone. ... > There are N stones, as the number of cells in the array. ... char Color(char *list, int pos) { ...
    (comp.lang.c)
  • Basic array question, need help
    ... My problem is that I can't figure out how to load the array. ... I tested this by adding the current int to the int in the previous ... I am also storing the logical end of the array in the 0 cell. ... public khNumberDisplayer() ...
    (comp.lang.java)
  • Re: Basic array question, need help
    ... > My problem is that I can't figure out how to load the array. ... > current int to the int in the previous cell. ... > storing the logical end of the array in the 0 cell. ... <SNIP CODE> ...
    (comp.lang.java)
  • (patch for Bash) regex case statement
    ... Following up on my previous patch for regex conditional tests, ... /* Return an array of strings; ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)