Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
/VM/station wiki
Search
Search
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Binary flags
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Operations in binary === What can we do with these numbers tho? There are 3 binary operators available in byond: And (&), Or (|) and Not (~). NOTE: These are binary operators, which means they do the operation on each individual bit. A good way to understand how these work is to not think of these 1s and 0s as numbers, but as truth and lies (false). So wherever you have a 1, you can substitute it with a true statement, while where you have a 0 you substitute it with a lie (a false statement). ==== Binary Not ( ~ ) ==== [[file:NOTgate.gif]] This is the simplest one. All it does it inverts the statement. ~0 = 1 ~1 = 0 The easiest way to understand this is simply, if you have a true statement "The sky is blue" and you stick a not in it, the statement's meaning is inverted: "The sky is not blue". So if the original statement was true (1), then the inverted one is of course false (0). ~1 = 0. The same applies if you negate a false statement. If you have a false statement: "The sky is green" and you negate it, it becomes the truth: "The sky is not green". ~0 = 1. ==== Binary And ( & ) ==== [[file:ANDgate.gif]] AND is defined with two statements. If you either of them is a lie, then the whole statement will be a lie. Because both the first AND the second must be true for the statement to be the truth. 0 & 0 = 0 (If you tell a lie, and then tell another lie, overall you are lying) 0 & 1 = 0 (If you tell a lie, and then tell some truth, you have still lied overall) 1 & 0 = 0 (If you tell the truth, but then lie, you have lied overall) 1 & 1 = 1 (If you tell the truth and then tell another truth, you have told the truth overall) ==== Binary Or ( | ) ==== [[file:ORgate.gif]] OR is also defined with two statements. It however only requires one of the two to be true for the statement to be true. 0 | 0 = 0 ( The sky is green or the night is sunny. Both statements are lies, so it is still a lie overall ) 0 | 1 = 1 ( The sky is green or the night is dark. One of the statements is true, so the overall statement is true ) 1 | 0 = 1 ( the sky is blue or the night is sunny. One of the statements is true, so the overall statement is true ) 1 | 1 = 1 ( the sky is blue or the night is dark. Both statements are true, meaning the overall statement is true ) ==== Binary Xor ( ^ ) ==== [[file:XORgate.gif]] XOR is like OR, except if both statements are true, the output is false. XOR is also known as a difference detector, it'll output true if the two inputs are different from each other. *0 ^ 0 = 0 *0 ^ 1 = 1 *1 ^ 0 = 1 *1 ^ 1 = 0
Summary:
Please note that all contributions to /VM/station wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
/VM/station wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width