View Single Post
  #6   Spotlight this post!  
Unread 30-11-2002, 13:04
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Technically you should use NOT instead of ~ for things like this. Also, you should use AND instead of &. & will calculate the bitwise "and" of your two expressions, meaning it will apply the "and" to each individual set of bits. If it so happens that both p1_y > 127 as well as p2_y > 127 evaluate to exactly 1, it will work. Otherwise it may not. ~ Will compute the bitwise NOT of your expression. Assuming the inner part evaluates to 1, ~ will make it 1111111111111110 (65534).

If you ever wonder what an expression will evaluate to, try popping it in RoboEmu and doing a debug. For example, using:

myVar= ~1
debug? myVar

will give you:
myVar=254

-and-

myVar=0-1
debug? myVar

will give you:
myVar=255
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php

Last edited by rbayer : 30-11-2002 at 13:11.