A Racket program that validates 9x9 Sudoku boards according to the standard Sudoku rules.
sudoku-validator.rkt- Main Racket source codetest1.txtthroughtest12.txt- Test cases (1-6 valid, 7-12 invalid)test-all.sh- Test script to run all test casesai-prompts.txt- Documentation of AI prompts usedmachine-generated-code.rkt- Copy of all AI-generated codereferences.txt- List of online references used
- Racket must be installed (can be installed via
brew install racketon macOS)
# Run with a single test file
racket sudoku-validator.rkt < test1.txt
# Run all tests
./test-all.shThe program expects input in the following format:
- 9 lines, each containing 9 single digits separated by whitespace
- A blank line
- An asterisk (*) to mark the end of input
Valid- if the Sudoku board is valid- Error message - if the board is invalid, describing the first issue found
The program checks that:
- Each digit 1-9 appears exactly once in each row
- Each digit 1-9 appears exactly once in each column
- Each digit 1-9 appears exactly once in each 3x3 subgrid
- test1.txt - test6.txt: Valid Sudoku boards
- test7.txt - test12.txt: Invalid Sudoku boards with various errors
This project was developed as part of a Racket/Functional Programming assignment. The code follows functional programming principles and uses Racket's built-in list operations and higher-order functions.