KenKen Generator
Created December 2018 - February 2019 as a Group Project for AP Computer Science A. GitHub Link
KenKen Rules
Think about Sudoku. There is one property of a solved sudoku puzzle: it is a latin square. A latin square is a square of size x that has the numbers 1 - x in each column and row exactly once. However, instead of having 3x3 boxes, a KenKen puzzle has cages with operations and target numbers. If a cage of size 3 has 6+ (target number: 6, operation: addition) written, then the 3 numbers must add up to 6. This would be the numbers 1,2,3. The difficulty in solving this puzzle comes from having to maintain the latin square properties while also satisfying the target numbers of each individual cage. Common KenKen sizes range from 4 x 4 - 9 x 9.
Methodology
To be added...
Prints out all elements in a cage, the operation, desired result, and the solution.
Sample Outputs
4 x 4 Difficulty: Easy
Position Coordinates: Row: 0 Col: 1 Row: 0 Col: 0 Row: 0 Col: 2 Operation: ADDITION Target Number: 7
Position Coordinates: Row: 2 Col: 1 Row: 3 Col: 1 Operation: SUBTRACTION Target Number: 1
Position Coordinates: Row: 2 Col: 3 Row: 2 Col: 2 Row: 3 Col: 3 Row: 3 Col: 2 Operation: MULTIPLICATION Target Number: 8
Position Coordinates: Row: 1 Col: 1 Row: 1 Col: 0 Operation: DIVISION Target Number: 4
Position Coordinates: Row: 2 Col: 0 Row: 3 Col: 0 Operation: SUBTRACTION Target Number: 1
Position Coordinates: Row: 1 Col: 2 Row: 0 Col: 3 Row: 1 Col: 3 Operation: MULTIPLICATION Target Number: 18
9 x 9 Difficulty: Hard
Position Coordinates: Row: 0 Col: 8 Row: 0 Col: 7 Row: 1 Col: 8 Row: 1 Col: 7 Operation: MULTIPLICATION Target Number: 270
Position Coordinates: Row: 1 Col: 4 Row: 1 Col: 3 Operation: SUBTRACTION Target Number: 5
Position Coordinates: Row: 2 Col: 8 Operation: null Target Number: 1
Position Coordinates: Row: 5 Col: 3 Row: 5 Col: 2 Row: 5 Col: 1 Operation: MULTIPLICATION Target Number: 240
Position Coordinates: Row: 8 Col: 6 Row: 8 Col: 5 Operation: MULTIPLICATION Target Number: 40
Position Coordinates: Row: 0 Col: 6 Row: 0 Col: 5 Row: 0 Col: 4 Row: 0 Col: 3 Operation: MULTIPLICATION Target Number: 210
Position Coordinates: Row: 6 Col: 3 Row: 7 Col: 3 Row: 7 Col: 2 Operation: MULTIPLICATION Target Number: 14
Position Coordinates: Row: 4 Col: 3 Row: 4 Col: 2 Row: 3 Col: 0 Row: 4 Col: 1 Row: 4 Col: 0 Operation: MULTIPLICATION Target Number: 240
Position Coordinates: Row: 6 Col: 7 Row: 5 Col: 7 Row: 6 Col: 8 Operation: MULTIPLICATION Target Number: 216
Position Coordinates: Row: 3 Col: 3 Row: 3 Col: 2 Operation: DIVISION Target Number: 3
Position Coordinates: Row: 4 Col: 5 Row: 4 Col: 4 Row: 5 Col: 5 Operation: MULTIPLICATION Target Number: 180
Position Coordinates: Row: 5 Col: 4 Row: 6 Col: 5 Row: 6 Col: 4 Operation: MULTIPLICATION Target Number: 54
Position Coordinates: Row: 2 Col: 7 Row: 3 Col: 8 Row: 3 Col: 7 Row: 4 Col: 7 Operation: MULTIPLICATION Target Number: 672
Position Coordinates: Row: 7 Col: 8 Row: 7 Col: 7 Row: 8 Col: 8 Row: 8 Col: 7 Operation: MULTIPLICATION Target Number: 240
Position Coordinates: Row: 5 Col: 0 Row: 6 Col: 0 Row: 7 Col: 1 Row: 7 Col: 0 Operation: MULTIPLICATION Target Number: 168
Position Coordinates: Row: 1 Col: 2 Row: 2 Col: 2 Row: 0 Col: 2 Operation: ADDITION Target Number: 15
Position Coordinates: Row: 1 Col: 6 Operation: null Target Number: 1
Position Coordinates: Row: 4 Col: 8 Row: 5 Col: 8 Operation: SUBTRACTION Target Number: 5
Position Coordinates: Row: 2 Col: 3 Row: 3 Col: 4 Row: 2 Col: 4 Row: 3 Col: 5 Operation: ADDITION Target Number: 24
Position Coordinates: Row: 7 Col: 4 Row: 8 Col: 4 Row: 8 Col: 3 Row: 8 Col: 2 Operation: ADDITION Target Number: 18
Position Coordinates: Row: 0 Col: 1 Row: 0 Col: 0 Row: 1 Col: 0 Operation: MULTIPLICATION Target Number: 128
Position Coordinates: Row: 8 Col: 1 Row: 8 Col: 0 Operation: MULTIPLICATION Target Number: 14
Position Coordinates: Row: 6 Col: 2 Row: 6 Col: 1 Operation: SUBTRACTION Target Number: 2
Position Coordinates: Row: 1 Col: 5 Row: 2 Col: 6 Row: 2 Col: 5 Operation: ADDITION Target Number: 16
Position Coordinates: Row: 7 Col: 6 Row: 7 Col: 5 Operation: SUBTRACTION Target Number: 3
Position Coordinates: Row: 1 Col: 1 Row: 2 Col: 1 Row: 2 Col: 0 Row: 3 Col: 1 Operation: MULTIPLICATION Target Number: 405
Position Coordinates: Row: 5 Col: 6 Row: 6 Col: 6 Row: 3 Col: 6 Row: 4 Col: 6 Operation: ADDITION Target Number: 16
8 | 4 | 6 | 3 | 7 | 2 | 5 | 1 | 9 |
4 | 9 | 2 | 8 | 3 | 7 | 1 | 6 | 5 |
9 | 5 | 7 | 4 | 8 | 3 | 6 | 2 | 1 |
5 | 1 | 3 | 9 | 4 | 8 | 2 | 7 | 6 |
6 | 2 | 4 | 1 | 5 | 9 | 3 | 8 | 7 |
1 | 6 | 8 | 5 | 9 | 4 | 7 | 3 | 2 |
7 | 3 | 5 | 2 | 6 | 1 | 4 | 9 | 8 |
3 | 8 | 1 | 7 | 2 | 6 | 9 | 5 | 4 |
2 | 7 | 9 | 6 | 1 | 5 | 8 | 4 | 3 |