Skip to content

Commit

Permalink
Removed last copy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtheturtle committed Jul 8, 2015
1 parent 4739829 commit f9ff18e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions boggle/boggle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import copy

# TODO add a way to input a board (text file / photo)


Expand Down Expand Up @@ -31,8 +29,6 @@ def is_available_route(word, tile_map):
routes = []

word_length = len(word)
if not tiles_available(word=word, tile_map=tile_map):
return False

for letter in word:
positions = tile_map[letter]
Expand All @@ -42,7 +38,7 @@ def is_available_route(word, tile_map):
for position in positions:
if (positions_touching(route[len(route) - 1], position) and
position not in route):
new_route = copy.copy(route)
new_route = route[:]
new_route.append(position)
includes_whole_word = len(new_route) == word_length
if includes_whole_word:
Expand Down Expand Up @@ -113,6 +109,7 @@ def is_valid_word(word, tile_map):
long_enough = len(word) > 2
word = word.upper().replace('QU', 'Q')
return (long_enough and
tiles_available(word=word, tile_map=tile_map) and
is_available_route(word=word, tile_map=tile_map))


Expand Down

0 comments on commit f9ff18e

Please sign in to comment.