Interesting Array Programs

Arrays can be used for a number of interesting things. Board games are one of the main things, as well as manipulating a number of similar objects (e.g. 10 balls).

Do any two of these programs below. This will give you 85% on this assignment. Once you have two done, you can do another if you want to get up to 100%.

Lights out(This may be too hard without graphics)

Do the "Lights Out" puzzle program for a single row of lights. See this example.
Make it so that you can change the number of lights to be 5 or more. How will the user indicate which light to click on?

Colours and Clothes

Make an array of a least 5 colours (Strings): String[] colours = {"Red","Green","White","Black","Yellow"};
Make another String array of at least 5 items of clothing.
Print out all combinations (e.g "Red shirt", "Red pants", "Red shoes" ... "Green shirt", "Green pants" , ...)

Guess my Colour

Make an array of a least 10 colours (Strings), but choose the hardest most obscure colours that you can think of. String[] colours = {"charcoal","azure", ...};
Your program will choose a random colour and print out the first letter.
This is how to print out the first letter of String word: System.out.println("The first letter is " + word.charAt(0));
Then give the user a certain number of guesses to get the answer.
If they can't get it in, say n=5 guesses, then print out the answer (or do something similar).

5 in a row

Make an array of integers that's 20 long (or maybe longer).
Fill it with 0,1,2, where there is a 25% chance of a zero, 25% chance of a two, and a 50% chance of a one.
Now check if there are 5 ones in a row (consecutive).
This is a useful thing to do for a game where you win if you get 5 in a row (e.g. giant TicTacToe), where 0=empty, 1=player1, and 2=player2.

Sudoku Row (Mostly done in class. Nov 2017)

Make an array of 9 integers. Fill it with random numbers from 1-9. Set any two elements to zero (zero=empty).
Now check to see if there are any number repeated. You are not allowed to have repeated numbers in a row in Sudoku.