Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page
Python - Boggle
► Problem Description: The game 'Boggle' is a game that's played on a 4 x 4 grid (each grid location holds a 6-sided die containing letters). Here is a list of the 16 dice and the letters found on each:
Die 01: { 'A', 'A', 'E', 'E', 'G', 'N' } Die 02: { 'A', 'B', 'B', 'J', 'O', 'O' } Die 03: { 'A', 'C', 'H', 'O', 'P', 'S' } Die 04: { 'A', 'F', 'F', 'K', 'P', 'S' } Die 05: { 'A', 'O', 'O', 'T', 'T', 'W' } Die 06: { 'C', 'I', 'M', 'O', 'T', 'U' } Die 07: { 'D', 'E', 'I', 'L', 'R', 'X' } Die 08: { 'D', 'E', 'L', 'R', 'V', 'Y' } Die 09: { 'D', 'I', 'S', 'T', 'T', 'Y' } Die 10: { 'E', 'E', 'G', 'H', 'N', 'W' } Die 11: { 'E', 'E', 'I', 'N', 'S', 'U' } Die 12: { 'E', 'H', 'R', 'T', 'V', 'W' } Die 13: { 'E', 'I', 'O', 'S', 'S', 'T' } Die 14: { 'E', 'L', 'R', 'T', 'T', 'Y' } Die 15: { 'H', 'I', 'M', 'N', 'U', 'Q' } [*] Die 16: { 'H', 'L', 'N', 'N', 'R', 'Z' }
First, you are to write a program to output random boggle boards. Some notes:
Next, you'll need to write code to read in a list of words from the file 'words.txt'. Then, have your program output a list of every word from 'words.txt' that was found in the current board. Some notes:
► Example Output:
Board ----- +----+----+----+----+ | T | I | R | A | +----+----+----+----+ | S | F | S | L | +----+----+----+----+ | E | E | V | T | +----+----+----+----+ | S | E | N | N | +----+----+----+----+ Words ----- a, arise, arisen, arises, as, eve, even, event, events, fee, fees, fest, fir, firs, first, fist, fit, fits, i, if, is, it, its, last, nest, rife, rift, rifts, rise, risen, rises, salt, salve, see, seen, sees, sent, seven, sift, sifts, sir, sirs, sit, sits, stir, stirs, tsar, vent, vents, vest Total words found: 50
► Source Code
All files (zip file)