cluster_1 = ['b','c','d','f','g','p','s','t','w'] def unique(seq): seen = set() seen_add = seen.add return [ x for x in seq if not (x in seen or seen_add(x))] def pos(seq, n): return [x for x in seq if x[0] >= 0 and x[1] >= 0 and x[0] < n and x[1] < n] n = 10 board = WordSearch(n,False) board.fill(n) board.print_board() wordlist = [i.upper() for i in board.get_wordlist()] for i in wordlist: print i, print '\n' #board length bl = len(board.board) # length of wordlist wl = len(wordlist) #first letters fl = [] #first letter locations (row,col) floc = [] #surrounds locations (row,col, loc) surfloc = []
from WordSearch import WordSearch board = WordSearch(5, True) board.fill(10) board.print_board() print board.get_wordlist()