Редактирование:
Binary flags
(раздел)
Перейти к навигации
Перейти к поиску
Внимание:
Вы не вошли в систему. Ваш 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
Описание изменений:
Пожалуйста, учтите, что любой ваш вклад в проект «massmeta» может быть отредактирован или удалён другими участниками. Если вы не хотите, чтобы кто-либо изменял ваши тексты, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений, или скопировали их из источника, допускающего свободное распространение и изменение своего содержимого (см.
Massmeta:Авторские права
).
НЕ РАЗМЕЩАЙТЕ БЕЗ РАЗРЕШЕНИЯ ОХРАНЯЕМЫЕ АВТОРСКИМ ПРАВОМ МАТЕРИАЛЫ!
Отменить
Справка по редактированию
(в новом окне)
Навигация
Персональные инструменты
Вы не представились системе
Обсуждение
Вклад
Создать учётную запись
Войти
Пространства имён
Статья
Обсуждение
русский
Просмотры
Читать
Править
История
Ещё
Поиск
Навигация
Заглавная страница
Свежие правки
Случайная страница
Справка по MediaWiki
Инструменты
Ссылки сюда
Связанные правки
Служебные страницы
Сведения о странице