-
Notifications
You must be signed in to change notification settings - Fork 3
/
col.py
29 lines (25 loc) · 802 Bytes
/
col.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import numpy as np
import colored
import sys
import math
lookup = [ 1,196,197,198,199,208,209,172,149, 2]
def print_row(a):
for x in a:
foo = np.around(math.floor(x * 999))
index = int(foo / 100)
color = colored.bg(lookup[10-index])
res = colored.attr('reset')
sys.stdout.write (color + str(int(foo)) + res)
#sys.stdout.write(" ")
sys.stdout.write("\n")
def print_row2(a, a2):
for i in range(0,len(a)):
x = a[i]
color = colored.bg(lookup[9-x])
if a2 is not None:
color += colored.fg(lookup[9-a2[i]])
res = colored.attr('reset')
sys.stdout.write (color + str(x) + res)
#sys.stdout.write(" ")
sys.stdout.write("\n")
#print_row([ 1,196,197,198,199,208,209,172,149, 2])