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