Upload the last of the Boggle files, start the Route Finding assignment.

This commit is contained in:
Charles Descamps 2025-02-26 15:17:39 -07:00
parent 29c46717d9
commit 01f18dd14a
5 changed files with 220 additions and 0 deletions

View file

@ -143,6 +143,35 @@ def runBoard(boardFileName, wordListFileName):
# (DONE) define runBoard and other functions. # (DONE) define runBoard and other functions.
print("\n2x2 Original\n")
runBoard("board2.txt", "twl06.txt") runBoard("board2.txt", "twl06.txt")
print("\n3x3 Original\n")
runBoard("board3.txt", "twl06.txt") runBoard("board3.txt", "twl06.txt")
print("\n4x4 Original\n")
runBoard("board4.txt", "twl06.txt") runBoard("board4.txt", "twl06.txt")
print("\n2x2 New First Board\n")
runBoard("boardT2.txt", "twl06.txt")
print("\n2x2 New Second Board\n")
runBoard("boardT2_1.txt", "twl06.txt")
print("\n2x2 New Third Board\n")
runBoard("boardT2_2.txt", "twl06.txt")
print("\n2x2 New Fourth Board\n")
runBoard("boardT2_3.txt", "twl06.txt")
print("\n3x3 New First Board\n")
runBoard("boardT3.txt", "twl06.txt")
print("\n3x3 New Second Board\n")
runBoard("boardT3_1.txt", "twl06.txt")
print("\n3x3 New Third Board\n")
runBoard("boardT3_2.txt", "twl06.txt")
print("\n3x3 New Fourth Board\n")
runBoard("boardT3_3.txt", "twl06.txt")
print("\n4x4 New First Board\n")
runBoard("boardT4.txt", "twl06.txt")
print("\n4x4 New Second Board\n")
runBoard("boardT4_1.txt", "twl06.txt")
print("\n4x4 New Third Board\n")
runBoard("boardT4_2.txt", "twl06.txt")
print("\n4x4 New Fourth Board\n")
runBoard("boardT4_3.txt", "twl06.txt")
print("\n4x4 New Fifth Board\n")
runBoard("boardT4_4.txt", "twl06.txt")

25
Boggle/04_generator.py Normal file
View file

@ -0,0 +1,25 @@
__author__ = 'Eck'
## VITAL: MUST be run using Python 3.6 or better...else random.choices fails. New in 3.6
import sys, string, random
'''
Utility script. creates a random boggle board of given size. Two commands line args:
N = the size of board desired
outFile = name of desired output file
'''
N=int(sys.argv[1])
outFile= sys.argv[2]
out = open(outFile,'w')
charlist= string.ascii_uppercase
for z in range(0,N):
line = ' '.join(random.choices(charlist,k=N))
out.write((line+"\n"))
out.close()
print("tada!")

36
RouteFinding/06_tests.py Normal file
View file

@ -0,0 +1,36 @@
# Define Searcher class here.
# 10test.txt map
x=Searcher("10test.txt", searchType="DEPTH", verbose=True)
x.setStartGoal('h','k')
x.search()
x=Searcher("10test.txt", searchType="BREADTH", verbose=True)
x.setStartGoal('h','k')
x.search()
x=Searcher("10test.txt", searchType="BEST", verbose=True)
x.setStartGoal('h','k')
x.search()
x=Searcher("10test.txt", searchType="A*", verbose=True)
x.setStartGoal('h','k')
x.search()
# 50test.txt map
x=Searcher("50test.txt", searchType="DEPTH", verbose=False)
x.setStartGoal('s','c')
x.search()
x=Searcher("50test.txt", searchType="BREADTH", verbose=False)
x.setStartGoal('s','c')
x.search()
x=Searcher("50test.txt", searchType="BEST", verbose=False)
x.setStartGoal('s','c')
x.search()
x=Searcher("50test.txt", searchType="A*", verbose=False)
x.setStartGoal('s','c')
x.search()

17
RouteFinding/10test.txt Normal file
View file

@ -0,0 +1,17 @@
('D', 'I', 377, [429, 260], [113, 308])
('I', 'B', 509, [113, 308], [499, 1])
('B', 'D', 275, [499, 1], [429, 260])
('A', 'E', 608, [607, 305], [267, 804])
('G', 'A', 127, [596, 191], [607, 305])
('A', 'H', 72, [607, 305], [547, 289])
('H', 'D', 135, [547, 289], [429, 260])
('J', 'H', 223, [454, 453], [547, 289])
('J', 'F', 127, [454, 453], [388, 366])
('I', 'C', 291, [113, 308], [209, 575])
('C', 'K', 270, [209, 575], [1, 675])
('F', 'C', 278, [388, 366], [209, 575])
('C', 'E', 293, [209, 575], [267, 804])
('L', 'F', 277, [337, 580], [388, 366])
('J', 'L', 193, [454, 453], [337, 580])
('L', 'C', 134, [337, 580], [209, 575])
('G', 'B', 235, [596, 191], [499, 1])

113
RouteFinding/50test.txt Normal file
View file

@ -0,0 +1,113 @@
('AL', 'AR', 357, [245, 1], [139, 276])
('AR', 'AI', 251, [139, 276], [129, 505])
('AI', 'M', 170, [129, 505], [1, 561])
('AR', 'T', 140, [139, 276], [221, 382])
('T', 'AI', 164, [221, 382], [129, 505])
('V', 'AB', 239, [709, 487], [595, 307])
('AB', 'AF', 303, [595, 307], [818, 163])
('AF', 'V', 442, [818, 163], [709, 487])
('AJ', 'T', 179, [254, 246], [221, 382])
('AJ', 'AE', 114, [254, 246], [339, 307])
('AE', 'T', 174, [339, 307], [221, 382])
('C', 'AG', 214, [1011, 631], [931, 460])
('AG', 'V', 229, [931, 460], [709, 487])
('AY', 'W', 91, [683, 861], [758, 858])
('AC', 'AN', 176, [142, 967], [280, 880])
('S', 'AJ', 285, [483, 279], [254, 246])
('AL', 'S', 371, [245, 1], [483, 279])
('S', 'AE', 157, [483, 279], [339, 307])
('AB', 'S', 131, [595, 307], [483, 279])
('G', 'AB', 122, [567, 421], [595, 307])
('V', 'G', 172, [709, 487], [567, 421])
('F', 'AN', 286, [89, 755], [280, 880])
('AC', 'F', 245, [142, 967], [89, 755])
('AN', 'AO', 79, [280, 880], [357, 860])
('AO', 'AK', 276, [357, 860], [362, 1086])
('AO', 'AS', 191, [357, 860], [505, 904])
('AS', 'AK', 259, [505, 904], [362, 1086])
('AN', 'L', 172, [280, 880], [361, 754])
('U', 'AM', 101, [444, 610], [491, 676])
('AM', 'L', 186, [491, 676], [361, 754])
('L', 'U', 196, [361, 754], [444, 610])
('AW', 'S', 81, [514, 339], [483, 279])
('G', 'AW', 113, [567, 421], [514, 339])
('B', 'AW', 110, [502, 441], [514, 339])
('E', 'A', 105, [349, 529], [442, 513])
('A', 'U', 122, [442, 513], [444, 610])
('U', 'E', 135, [444, 610], [349, 529])
('AE', 'K', 107, [339, 307], [337, 414])
('K', 'T', 149, [337, 414], [221, 382])
('J', 'U', 192, [323, 706], [444, 610])
('L', 'J', 77, [361, 754], [323, 706])
('J', 'E', 222, [323, 706], [349, 529])
('J', 'AA', 194, [323, 706], [226, 556])
('AA', 'E', 143, [226, 556], [349, 529])
('AN', 'J', 224, [280, 880], [323, 706])
('W', 'Y', 220, [758, 858], [759, 657])
('Y', 'C', 321, [759, 657], [1011, 631])
('C', 'W', 417, [1011, 631], [758, 858])
('AV', 'F', 141, [8, 646], [89, 755])
('AM', 'AQ', 169, [491, 676], [427, 817])
('AQ', 'L', 105, [427, 817], [361, 754])
('AQ', 'AO', 101, [427, 817], [357, 860])
('AQ', 'AS', 145, [427, 817], [505, 904])
('AU', 'AM', 113, [500, 582], [491, 676])
('U', 'AU', 72, [444, 610], [500, 582])
('A', 'AU', 99, [442, 513], [500, 582])
('A', 'B', 96, [442, 513], [502, 441])
('B', 'AU', 171, [502, 441], [500, 582])
('I', 'K', 75, [404, 421], [337, 414])
('AE', 'I', 162, [339, 307], [404, 421])
('S', 'I', 199, [483, 279], [404, 421])
('B', 'I', 124, [502, 441], [404, 421])
('A', 'I', 108, [442, 513], [404, 421])
('E', 'I', 121, [349, 529], [404, 421])
('E', 'K', 129, [349, 529], [337, 414])
('O', 'K', 150, [265, 508], [337, 414])
('E', 'O', 94, [349, 529], [265, 508])
('AA', 'O', 77, [226, 556], [265, 508])
('O', 'T', 172, [265, 508], [221, 382])
('O', 'AI', 167, [265, 508], [129, 505])
('AA', 'AI', 125, [226, 556], [129, 505])
('J', 'Q', 88, [323, 706], [247, 693])
('Q', 'AA', 162, [247, 693], [226, 556])
('F', 'Q', 190, [89, 755], [247, 693])
('Q', 'AN', 218, [247, 693], [280, 880])
('AT', 'V', 84, [745, 546], [709, 487])
('Y', 'AT', 127, [759, 657], [745, 546])
('AT', 'P', 116, [745, 546], [653, 611])
('P', 'V', 175, [653, 611], [709, 487])
('Y', 'P', 120, [759, 657], [653, 611])
('AI', 'D', 103, [129, 505], [71, 577])
('D', 'M', 74, [71, 577], [1, 561])
('D', 'AV', 110, [71, 577], [8, 646])
('N', 'G', 153, [573, 569], [567, 421])
('N', 'B', 161, [573, 569], [502, 441])
('N', 'AU', 76, [573, 569], [500, 582])
('H', 'AY', 85, [600, 880], [683, 861])
('AS', 'H', 101, [505, 904], [600, 880])
('AP', 'AH', 72, [603, 677], [624, 735])
('AH', 'AM', 168, [624, 735], [491, 676])
('AM', 'AP', 135, [491, 676], [603, 677])
('AD', 'AQ', 142, [564, 812], [427, 817])
('AM', 'AD', 183, [491, 676], [564, 812])
('AH', 'AD', 117, [624, 735], [564, 812])
('AD', 'AS', 119, [564, 812], [505, 904])
('AD', 'H', 94, [564, 812], [600, 880])
('AH', 'AY', 168, [624, 735], [683, 861])
('AY', 'AD', 132, [683, 861], [564, 812])
('AX', 'AP', 144, [711, 730], [603, 677])
('AP', 'P', 89, [603, 677], [653, 611])
('AX', 'AH', 103, [711, 730], [624, 735])
('W', 'AX', 158, [758, 858], [711, 730])
('AY', 'AX', 155, [683, 861], [711, 730])
('Q', 'X', 156, [247, 693], [134, 628])
('X', 'AA', 116, [134, 628], [226, 556])
('X', 'AI', 150, [134, 628], [129, 505])
('X', 'D', 100, [134, 628], [71, 577])
('F', 'X', 152, [89, 755], [134, 628])
('AV', 'X', 161, [8, 646], [134, 628])
('R', 'AP', 70, [546, 638], [603, 677])
('AU', 'R', 82, [500, 582], [546, 638])
('N', 'R', 81, [573, 569], [546, 638])
('P', 'R', 135, [653, 611], [546, 638])