1 / 20

# - PowerPoint PPT Presentation

Logic Networks … and the card game Boolette. MAT 385 Mullins - Reinecke. Overview. Logic networks, or digital circuits, are physical elements used in computers to perform arithmetic operations or make logical choices.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about '' - angie

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Logic Networks…and the card game Boolette

MAT 385 Mullins - Reinecke

• Logic networks, or digital circuits, are physical elements used in computers to perform arithmetic operations or make logical choices.

• These networks are made up of primitive elements called logicgates, with binary inputs and outputs.

• We can think of these circuits as series of electronic components that perform Boolean operations in order to solve problems.

Logic gates are the building blocks that make up digital circuits.

A gate receives one or more inputs (binary 1s and 0s), performs a Boolean operation on them, and outputs the result as a 1 or 0.

The logic gates shown to the left represent their Boolean algebra counterparts: * for AND, + for OR, ‘ for NOT. The NAND and NOR gates are simply the negation (‘) of AND and OR expressions. The NOT gate, also called an inverter, represents the negation of a single input. XOR outputs a 1 only when inputs differ.

via chucklecloud.com

• A single truth function or Boolean expression can be used to draw the corresponding logic network. The next slide shows how to derive a Boolean expression from a truth function, and in turn, how to draw a simple logic network using the Boolean expression.

• The method that will be used is known as the canonical sum of products (SOP), in which we combine scenarios that will cause our logic network to output a 1.

Truth Function Expressions

Our inputs are x1 and x2, and F represents the function of the two inputs. We focus on where the output of the function is a 1, so there are three products to sum.

As a Boolean algebraic expression, the SOP would look like this:

x1x2 + x1x2’ + x1’x2’

This expression can be used to create the following logic network:

Practical Implementations Expressions

• Half Adder – adds two single bits and outputs the sum and the carry digit.

• Full Adder – adds two bits and a carry-in bit and outputs a sum bit and carry-out bit.

• Shifter

• The half adder adds two binary digits and outputs the sum and carry digit.

• Using this picture, if A = 1 and B = 1, then the output will be S=0, C=1.

S: 1 XOR 1 = 0

C: 1 AND 1 = 1

Note: The sum only shows the last bit. The real answer to this would be S=10, C=1 but we can only store one digit for S.

• The full adder will compute the sum of binary digits and will take a carry-in digit from another computation. The output will be the sum and the carry-out.

• If A=1, B=0, and the carry-in digit=1, then the output would be S=0, carry-out digit=1.

S: 1 XOR 0 = 1, 1 XOR 1 = 0

Cout: 1 XOR 0 = 1, 1 AND 1 = 1, 1 AND 0 = 0,

1 OR 0 = 1

Shifter Expressions

• A shifter moves digits to the right or left, storing a 0 in the place of the leading bit and moving the last bit off. Ex: Right shift of 1001 will be 0100.

• An arithmetic shifter will move the digits left or right, but will replace the leading bit with whatever digit it was before the shift.

Ex: Arithmetic right shift of 1011 will be 1101.

The 4-bit right shifter takes a selector bit and 4 input bits, producing an output of 4 bits.

Boolette Expressions (a not-so-practical implementation)

• Boolette is an open-source strategic card game created by James Fennell and Niamh Tobin in 2010. Two players face each other, using Boolean logic and logic gates to “resolve an initial six digit binary number to a single specific bit.”

• Boolette implements the logic gates of AND, OR, XOR, and the inverter NOR.

Setup Expressions

• The game begins with six initial “bit cards”, which are simply cards with a 1 and a 0 on them. These cards are to be shuffled/rotated and laid out in a row (above). This can be considered the game’s backbone, as other cards will first be played off of the six bit cards.

• Players will face opposing sides of the row. In this case, one player would face “001010” and the other would face “101011”.

• The goal is to lay out cards turn by turn, creating a full pyramid with the final card’s bit matching the rightmost bit of the six bit cards. (the bolded bits above indicate each player’s target bit)

The Deck Expressions

• The deck consists of 4 cards of each of the following:

AND 0, AND 1,

OR 0, OR 1,

XOR 0, XOR 1,

NOT

giving a total of 28 cards.

• The six bit cards used at the start of the game.

Taking Turns Expressions

• One player starts as the dealer, randomly dealing 4 cards to each player. The dealer gets the first turn. On each turn, a player must pick up a card from the remaining deck. Then, the player must play a valid card from his or her hand (now 5 cards). If the player does not have a valid card, they must discard to a secondary pile. Once a card is either played or discarded, the other player’s turn begins.

• Note: Once the remainder of the deck is depleted, the secondary discard pile is shuffled and becomes the pick-up deck.

The Cards Expressions

How to Play a Card Expressions

• Each card features an illustrated logic gate, its corresponding Boolean operation in text, and a bit value (either 1 or 0). The way the game is played is to lay down a card under two inputs, where the input values are fed into the gate drawn on the card. Further, in order to be a valid move, the bit on the card must represent the correct output of the two inputs.

• For example, if the two inputs are {1,0}, and the card being played is XOR 1, then that card is valid (the Boolean operation 1 XOR 0 equates to 1). Only valid cards can be played.

If you play your cards right… Expressions

• Once a card is played, it will then serve as 1 of 2 input values for another card in the next layer in the pyramid. The pyramid will consist of the six initial bits, then a layer of 5 cards, a layer of 4 cards, and so on until one card remains that matches the original target bit. Once either player completes a pyramid of valid cards in this fashion, the game is over.

NOT Card Expressions

• At this point, Boolette seems like a straightforward game. However, its creators wanted to make things more interesting by the addition of the NOT card. If a player chooses to play a NOT card, they do so by applying it to one of six original bit cards. This causes the bits to be flipped (0 becomes 1, 1 becomes 0). As a result, many of the valid cards that have been played up to that point could be rendered invalid. Invalid cards then must be removed from game and placed in the discard pile.

• Ideally, a player would want to play a NOT card to avoid defeat when their opponent is close to victory. However, keep in mind that flipping bits will likely affect both players’ cards. Still, the goal is to remove more of your opponent’s cards than your own. To counteract the effects of a NOT card, the other player can play their own NOT card if they happen to have one in their hand.

Cascading Effects of a NOT Card Expressions

The NOT card has wiped out cards from both players’ pyramids. While both players must begin to rebuild, player 2 now has more valid cards than player 1.

Notice in the first image that player 1 was only one card away from victory when player 2 played a NOT card.

• Boolette Expressions is completely open-source and is currently not being sold or actively distributed. However, its developers have offered free downloads of all source materials.