Difference between revisions of "CSC352 Game of Life in Map-Reduce"
Line 53: | Line 53: | ||
isRawLife = line.find( "\"" ) != -1 | isRawLife = line.find( "\"" ) != -1 | ||
+ | # are we reading the original array of cells from a file? | ||
if isRawLife: | if isRawLife: | ||
lineNo = int( words[0] ) | lineNo = int( words[0] ) | ||
Line 68: | Line 69: | ||
if row == lineNo and col == j: continue | if row == lineNo and col == j: continue | ||
print( "%03d%03d\t%s" % ( row, col, "OneMoreNeighbor" ) ) | print( "%03d%03d\t%s" % ( row, col, "OneMoreNeighbor" ) ) | ||
− | + | ||
+ | # or are we reading tuples output by the reducer? | ||
else: | else: | ||
lineNo = int( words[0] ) | lineNo = int( words[0] ) | ||
Line 177: | Line 179: | ||
</source> | </source> | ||
+ | <br /> | ||
+ | ==Output of ShuffleSort== | ||
+ | <br /> | ||
+ | '''cat life0.txt | ./mapper.py | ./shuffleSort.py ''' | ||
+ | 000004 OneMoreNeighbor | ||
+ | 000005 OneMoreNeighbor | ||
+ | 000006 OneMoreNeighbor | ||
+ | 001004 OneMoreNeighbor | ||
+ | 001004 OneMoreNeighbor | ||
+ | 001005 OneMoreNeighbor | ||
+ | 001005 alive | ||
+ | 001006 OneMoreNeighbor | ||
+ | 001006 OneMoreNeighbor | ||
+ | 002004 OneMoreNeighbor | ||
+ | 002004 OneMoreNeighbor | ||
+ | 002004 OneMoreNeighbor | ||
+ | 002005 OneMoreNeighbor | ||
+ | 002005 OneMoreNeighbor | ||
+ | 002005 alive | ||
+ | 002006 OneMoreNeighbor | ||
+ | 002006 OneMoreNeighbor | ||
+ | 002006 OneMoreNeighbor | ||
+ | 003004 OneMoreNeighbor | ||
+ | 003004 OneMoreNeighbor | ||
+ | 003005 OneMoreNeighbor | ||
+ | 003005 alive | ||
+ | 003006 OneMoreNeighbor | ||
+ | 003006 OneMoreNeighbor | ||
+ | 004004 OneMoreNeighbor | ||
+ | 004005 OneMoreNeighbor | ||
+ | 004006 OneMoreNeighbor | ||
+ | |||
<br /> | <br /> | ||
=Reducer.py= | =Reducer.py= |