Print matches asynchronously.
[utils.git] / icom
... / ...
CommitLineData
1#!/usr/bin/python
2
3import sys
4
5if len(sys.argv) < 3:
6 sys.stderr.write("usage: icom FILE1 FILE2\n")
7
8tsz = (25, 25)
9
10files = []
11
12for i in xrange(2):
13 f = open(sys.argv[i + 1])
14 lines = []
15 for y in xrange(tsz[1]):
16 line = []
17 for x in xrange(tsz[0]):
18 p = []
19 for c in f.read(3):
20 p.append(ord(c))
21 line.append(tuple(p))
22 lines.append(line)
23 files.append(lines)
24 f.close()
25
26sum = 0
27
28for y in xrange(tsz[1]):
29 for x in xrange(tsz[0]):
30 p = [f[y][x] for f in files]
31 for c in xrange(2):
32 sum += abs(p[0][c] - p[1][c])
33
34print sum