# teaching machines

## CS 145 Lecture 25 – Array Bingo

October 29, 2014 by . Filed under cs145, fall 2014, lectures.

• what ?s
• array bingo
• you call

### Bingo

The rules:

1. Each player drafts a board: an array of 10 ints in [0, 9].
2. The instructor calls out a series of boolean expressions that involve elements of the players’ boards. The leftmost element identified in the expression is the target. If the expression is true for the target element on a player’s board, the player crosses the target element off.
3. Occasionally the subscript of the target element will be expressed in terms of i. On such occasions, i can take on any value in [0, 9], and multiple target elements may be crossed off.
4. The first player(s) to cross off all 10 elements wins.

board[0] == 3
board[4] % 2 == 1
board[9] > 5
board[i] == board[i - 1]
board[3] < 2 * board[5]
board[7] == board[6] + 1
board[i] == 0
board[2] < 7
board[board[3]] < 6
board[6] > board[1] + board[2]
board[5] >= board[0] && board[5] <= board[1]
board[board[i]] = i
board[8] % 3 == 2
board[1] < 10
board[i] == board[9 - i]
board[4] > board[9 / 2]
board[7] == board[0] || board[7] == board[1] || board[7] == board[2] || board[7] == board[3]
board[d6 roll] < d12 roll
board[i / 2] <= 4
board[i % 3] >= 7
board[5] > 100 % 3
board[6] < board[8] - board[7]
board[i] > board[i + 1] + 1
board[i % 4 + 3] >= 2
board[7] < board[5] - board[9]
board[4] != board[1]
board[d6 roll] > d6 roll

### Code

#### ArrayPondering.java

package lecture1029;

import java.util.Arrays;

public class ArrayPondering {
public static void main(String[] args) {
int[] apollo = {6};

System.out.println(Arrays.toString(apollo));
fiddleWith(apollo);
System.out.println(Arrays.toString(apollo));

}

public static void fiddleWith(int[] numbers) {
numbers[0] = 10;
}
}

### Haiku

on automation: I can’t do things twice I’d rather build a machine Than be a machine