CS 145 Lecture 25 – Array Bingo
October 29, 2014 by Chris Johnson. Filed under
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
cs145, fall 2014, lectures.
Agenda
- what ?s
- array bingo
- you call
Bingo
The rules:
- Each player drafts a board: an array of 10 ints in [0, 9].
- 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.
- 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.
- 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