#!/usr/local/bin/python3
import sys
from trie2 import Trie

# Get word to dump scrabble solutions for
lettersStr = ""
if (len(sys.argv) > 1):
    lettersStr = sys.argv[1]
else:
    sys.exit(0)

letters = list(lettersStr)

# Build a trie of valid words
words = []
wordsTrie = Trie()
with open("dict.txt") as f:
    words = f.readlines()
    # Chomp the newline
    for i in range(len(words)):
        words[i] = words[i].rstrip()
        wordsTrie.add(words[i])

# Build a dict of point values for the letters
points = {}
points['a'] = 1
points['b'] = 3
points['c'] = 3
points['d'] = 2
points['e'] = 1
points['f'] = 4
    stateList = []
    startState = []
    for cars in carList2:
        startState.append(cars[0]+cars[1]*6)

    stateList.append(startState)
    stateList.append([19,22,9,10])
    stateList.append([19,22,15,10])
    stateList.append([19,22,21,10])
    stateList.append([19,22,27,10])
    stateList.append([19,22,27,9])
    stateList.append([19,22,27,8])
    stateList.append([19,16,27,8])
    stateList.append([19,10,27,8])
    stateList.append([19,4,27,8])
    stateList.append([20,4,27,8])
    stateList.append([21,4,27,8])
    stateList.append([22,4,27,8])

    print stateList
    trie = Trie(6, carList2)
    for states in stateList:
        print trie.checkState(states)
    for states in stateList:
        trie.addState(states)
    for states in stateList:
        print trie.checkState(states)


    runSimulation(carList2, stateList, 6, 6, 0.5)