Re: TIB: Boolean statments..(BJE)


[Prev][Next][Index][Thread]

Re: TIB: Boolean statments..(BJE)




Bill James Ellis wrote:
> 
> > On Thu, 05 Feb 1998 20:28:15 -0600 Christopher Robin MacDougald
> > <crmacd@mail.utexas.edu> wrote:
> 
> (i have choped out most (pretty much all, achually;)  of the code as
> its just one line that i want to discuss. I am fairly certain that
> evryone got a copy of the souce code for 'ARCADE.82P'. My appoliges to
> the author if he/she (girls can be called Chris, i think) takes
> offecnce at my dicing...)
> 
> > :If J=26 and H+8\<=\I
> > :If I-8\<=\H and J\<>\34
> > :If H+9\>=\I and K\<>\34
> > :If I-9\<=\H and J\<>\34
> > :If J=21 or J=22 or J=32 or K=14
> > :If J=21 or J=22 or J=31 or J=32 or K=14
> > :If K=21 or K=22 or K=32 or J=14
> > :If K=21 or K=22 or K=31 or K=32 or J=14
> 
> Well, its the use of Boolean statments. In my (small) programming
> experiance for my calcuator (TI-83), i found that these lines took up a
> lot of time. I (in my second and not quite finished game..) also had
> lots of conditional statments but found that splitting then up speeded
> things up, eg.
> 
> If K=21
> Then
> <DOTHIS>
> Else
> If K=22
> Then
> <DOTHIS>
> Else
> If K=32
> Then
> <DOTHIS>
> Else
> If J=14
> Then
> <DOTHIS>
> End
> End
> End
> End
> 
> So if one is true the rest is missed, and <DOTHIS> can be a sub routine.
> 
> I know it takes up much more code, so i woneder where the balance
> between too much code and speed lies?
> 
> Bill J Ellis
> 
> ----------------------------
> Bill James Ellis
> Heriot-Watt University

This just hits the point we've been talking about. If you HAVE to have 
speed, then go for the faster, but bigger, code. However, I think that 
you should optimize space unless you absolutely HAVE to be fast.

Jody Snider
jody1@alaska.net


References: