View difference between Paste ID: JaWh5JCP and smvgh7fV
SHOW: | | - or go back to the newest paste.
1-
leftmost = 15
1+
leftmost = 15		#Initial value
2-
for y in range(16):
2+
for y in range(16):	#Loop by rows
3-
	count = 0
3+
	count = 0 	#Count keeps track of the pixel position
4-
	pos = 128 * y + 40
4+
	pos = 128 * y + 40 				#Offset to the start of a row
5-
	for x in range(8):
5+
	for x in range(8): 				#Loop now by the column. This keeps track of bytes
6-
		if data[pos] >> 4 > 0:
6+
		if data[pos] >> 4 > 0: 			#Checking the first pixel in the byte for non-zero value
7-
			if leftmost > count:
7+
			if leftmost > count: 		#Update leftmost (if appropriate)
8
				leftmost = count
9
				break
10-
		count += 1
10+
		count += 1				#Increment pixel counter
11-
		if data[pos] & 15 > 0:
11+
		if data[pos] & 15 > 0: 			#Checking the 2nd pixel in the byte for non-zero value
12-
			if leftmost > count:
12+
			if leftmost > count:		#Update leftmost (if appropriate)
13
				leftmost = count
14
				break
15-
		count += 1
15+
		count += 1				#Increment pixel counter