RiftWorks
Найти
Персональное меню
Вы не представились системе
user-interface-preferences
Персональные инструменты
Обсуждение
Вклад
Создать учётную запись
Войти
Параметры
notifications
Редактирование:
Binary flags
(раздел)
associated-pages
Статья
Обсуждение
Просмотры
Читать
Править
Править код
История
Внимание:
Вы не вошли в систему. Ваш IP-адрес будет общедоступен, если вы запишете какие-либо изменения. Если вы
войдёте
или
создадите учётную запись
, её имя будет использоваться вместо IP-адреса, наряду с другими преимуществами.
Анти-спам проверка.
Не
заполняйте это!
=== Operations in binary === What can we do with these numbers though? 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
Описание изменений:
Обратите внимание, что все изменения в RiftWorks рассматриваются как выпущенные на условиях лицензии Creative Commons Attribution-NonCommercial-ShareAlike (см.
RiftWorks:Авторские права
). Если вы не хотите, чтобы ваши тексты свободно распространялись и редактировались любым желающим, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений или скопировали их из источника в общественном достоянии или под совместимой лицензией.
Не размещайте без разрешения материалы, защищённые авторским правом!
Отменить
Справка по редактированию
(в новом окне)