delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/31/17:50:58

Message-Id: <199810312250.WAA05681@relay.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: Random numbers, 'or ' and 'and' ;
Date: Sat, 31 Oct 1998 22:46:11 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <01be0514$a99ee440$2e884fd1@default>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> I am writing a rts game.  full code below. I am going quite well despite
> having a few problems, i drew 106 different tiles for water,
> grass and dirt
> and joins between them, i use rotate sprite and use angles for
> units rather
> than directions. my problems are :
>
> 1: I cannot find out how to use and  or  or  in an if statement
>
> i tried all of these but they dont work.. I would really appreciate it if
> someone told me what whas wrong
>
> if(a and b) blah;
> if((a) and (b)) blah;
> if(a & b) blah;
> if((a) & (b)) blah;
>
> if(a or b) blah;
> if((a) or (b)) blah;
> if(a || b) blah;
> if((a) || (b)) blah;

if(a & b) blah; - bitwise AND
if(a && b) blah; - logical AND
if(a | b) blah; - bitwise OR
if(a || b) blah; - logical OR

These are basic operators in C, and should be covered in any C reference.

> 2: I cant seem to find a procedure that makes random numbers.

Have you tried random()? Check the libc reference for details.

> Here is the code, it is a bit slopy with not many comments and is hard to
> follow and is very un optimised i think :<

What do you want us to do with it? Please specify more clearly.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019