In [3]:
import os
import tables
  • Initialize Data
    • Create hdf5 file
    • Load Constants
    • Create fixed data (e.g. list of all car positions, list of red car positions)
    • Spin up working data structures
  • Create and record states based on input value for #cars and #trucks

    • For each red car position:
      • Place red car on board
      • Recurse through placing the remaining cars
      • Remove red car from board
  • Close hdf5 file

Create States

  • Place red car on board
  • Recursively place each non-red car on the board until all cars are gone or board is empty
  • Upon reach base case, record state in hdf5 file

In [4]:
a = [{}] * 5

In [5]:
a


Out[5]:
[{}, {}, {}, {}, {}]

In [7]:
range(12,18)


Out[7]:
[12, 13, 14, 15, 16, 17]

In [10]:
for i in  range(26,26):
    print i

In [25]:
d =  {'x':1,'y':2,'z':3}
d['y']


Out[25]:
2

In [40]:
import pandas as pd
import collections

In [41]:
a = collections.OrderedDict
b = collections.OrderedDict
a['A'] = [1,2,3]
a['B'] = [4,5,6]
a['C'] = [2,3,4]


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-41-a605b7115d81> in <module>()
      1 a = collections.OrderedDict
      2 b = collections.OrderedDict
----> 3 a['A'] = [1,2,3]
      4 a['B'] = [4,5,6]
      5 a['C'] = [2,3,4]

TypeError: 'type' object does not support item assignment

In [31]:
df_a = pd.DataFrame.from_items( [ ['A',[1,2,3]] , ['B',[4,5,6]], ['C',[2,3,4]] ]  )
df_b = pd.DataFrame.from_items( [ ['A',[1,2,4]] , ['B',[4,6,3]], ['D',[2,3,4]] ]  )
df_a


Out[31]:
A B C
0 1 4 2
1 2 5 3
2 3 6 4

In [34]:
df_b


Out[34]:
A B D
0 1 4 2
1 2 6 3
2 4 3 4

In [39]:
pd.merge(df_a,df_b,how='right', on=['A','B'])


Out[39]:
A B C D
0 1 4 2 2
1 2 6 NaN 3
2 4 3 NaN 4

In [ ]: