https://github.com/oluwxtope/ken-gratulations
Python program that solves KenKen puzzle inputed as txt file. Done as final project for CS course
https://github.com/oluwxtope/ken-gratulations
Last synced: 8 months ago
JSON representation
Python program that solves KenKen puzzle inputed as txt file. Done as final project for CS course
- Host: GitHub
- URL: https://github.com/oluwxtope/ken-gratulations
- Owner: Oluwxtope
- Created: 2021-09-11T00:58:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-07T04:10:51.000Z (over 3 years ago)
- Last Synced: 2025-01-11T01:44:24.042Z (10 months ago)
- Language: Python
- Homepage:
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ken-gratulations
## Table of Contents
---
1. [How to Play](#how-to)
2. [Creating Your Input File](#create-input)
3. [Solving the Puzzle](#solve-puzzle)
4. [Versions](#versions)
5. [Future Updates](#future)

*4x4 KenKen puzzle no. 200059 from [kenkenpuzzle.com](https://www.kenkenpuzzle.com/)*
---
Each KenKen puzzle is a square with dimensions *n* by *n*. The objective is to fill the grid in with the digits 1 through *n* so that:
1. Each row contains exactly one of each digit
2. Each column contains exactly one of each digit
3. Each bold-outlined group of cells is a cage containing digits which achieve the specified result using the specified mathematical operation: addition (+), subtraction (−), multiplication (×), and division (÷).
---
1. Create a text input file and remember the name as you will definitely need it later
2. Using the above KenKen puzzle as an example, your input file will be formatted as follows:
1. First line contains the dimension of your KenKen puzzle *n* (it's a square so the size of only one side is needed)
> 4
2. Next *n* lines will be formatted to look like a text representation of the KenKen puzzle with letters representing cells starting from the top left moving across. Each line will have *n* letters each separated by a space and each letter will represent a cell in the bold outlined cage, with a unique letter being assigned to each one cage. The number of unique letters in the input file will equal the number of cages in the KenKen puzzle. An example is given below:
> a b b c
> a d d c
> e e d f
> g g f f
3. The last lines will have each unique letter representing the cage, the specified result, and the operation. If the cage has just one cell, the operator should be an equal (=) sign
> a 12 *
> b 2 /
> c 3 -
> d 6 +
> e 2 /
> f 9 +
> g 2 -
4. Save the input text file in the same directory as kenken.py
---
1. Run kenken.py and enter the name of the input file with the extension
> `python3 kenken.py`
> `input.txt`
2. The program will output your solution in a text file *solution.txt*
> 3 1 2 4
> 4 2 3 1
> 2 4 1 3
> 1 3 4 2
3. Ken-gratulations! You can brag to your friends about how genius you are!

*4x4 KenKen puzzle no. 200059 solution from [kenkenpuzzle.com](https://www.kenkenpuzzle.com/)*
---
**Version 1.0**
*Original code w tests commented out*
**Version 1.1**
*Gets filename input using while loop*
---
*Add GUI and user interface*
*Source input using image recognization*
*Provide answers in GUI*