Upowords-Game is a C implementation of a word-based board game, similar to Scrabble, with advanced features such as dynamic board resizing, undo functionality, and robust word validation. The project is structured for both educational and testing purposes, with a strong focus on modularity and testability.
- Dynamic 2D board with support for horizontal and vertical word placement
- Word validation using a large dictionary
- Undo functionality for moves
- Extensive automated test suite using GoogleTest
- Modular codebase with clear separation between game logic and testing
.
├── CMakeLists.txt
├── include/
│ └── hw3.h # Main game logic header
├── src/
│ ├── hw3.c # Core game logic implementation
│ └── hw3_main.c # Main entry point for the game
├── tests/
│ ├── boards/ # Sample board input files
│ ├── expected_outputs/ # Expected outputs for test cases
│ ├── include/
│ │ └── tests_aux.h # Test helper header
│ ├── src/
│ │ ├── tests_*.cpp # GoogleTest test suites
│ │ ├── tests_aux.cpp # Test helper implementations
│ │ └── standalone_scripts/
│ │ └── *.c # Standalone test scripts for edge cases
│ └── words.txt # Dictionary of valid words
└── CSE 220 Homework Assignment #3.pdf # Assignment specification
-
Requirements:
- CMake >= 3.10
- GCC or Clang (C11/C++14 support)
- GoogleTest
-
Build the main game:
cmake -S . -B build cmake --build build -
Run the game:
./build/hw3_main
-
Run all tests:
./build/run_all_tests
-
Build and run individual test suites (for CodeGrade):
cmake -DBUILD_CODEGRADE_TESTS=ON -S . -B build cmake --build build ./build/tests_multiple_turns
- CMakeLists.txt: Build configuration for the project and tests.
- include/hw3.h: Declares the
GameStatestruct and all core game functions. - src/hw3.c: Implements the game logic, including board management, word validation, and undo.
- src/hw3_main.c: Main program for running the game interactively or via test harness.
- tests/boards/: Input files representing initial board states for tests.
- tests/expected_outputs/: Output files with expected board states after moves.
- tests/include/tests_aux.h: Helper functions for test code.
- tests/src/tests_*.cpp: GoogleTest-based test suites for various scenarios (valid/invalid moves, undo, etc.).
- tests/src/standalone_scripts/: Standalone C scripts for edge-case or memory-check testing.
- tests/words.txt: Dictionary of valid words (2.4MB).
- Automated tests are written using GoogleTest and cover a wide range of scenarios, including valid/invalid moves, board resizing, and undo operations.
- Test outputs are compared against expected outputs for correctness.
This project is for educational purposes as part of CSE 220.