Exemple #1
0
def doloop():
    h = hexy.Hexy(x, y)
    for i in rag(ra, c):
        #h=hexy.Hexy(x,y)
        ai, bi = next(spiral)
        h.draw(a - i - ai, b - i - bi, i)
        print(h.show())
        click.clear()
        time.sleep(0.3)
Exemple #2
0
def doloop():
    global c
    if c % 3 == 0: c = 1
    c += 1
    h = hexy.Hexy(x, y)
    for i in rag(ra, c):
        #h=hexy.Hexy(x,y)
        h.draw(a - i, b - i, i)
        print(h.show())
        click.clear()
        time.sleep(0.3)
Exemple #3
0
def loop():
    c = 1
    while 1:
        h = hexy.Hexy(H, V)
        x = next(hc) + H
        y = next(vc) + (V // 2)
        r = next(rc)
        c += 3
        c %= H
        x += c
        y += c
        h.circle(x, y, r, r + 2, 'o')
        p(h, T, (x, y, r, r + 2))
Exemple #4
0
def loop():
    c = 1
    while 1:
        h = hexy.Hexy(H, V)
        x = next(hc) + H
        y = next(vc) + (V // 2)
        r = next(rc)
        c += 1
        #c%=H
        x = c
        y = c
        #x+=random.randrange(-1,1)
        #y+=random.randrange(-1,1)
        #h.circle(x,y,r,r+2,'o')
        keep_circle(h, x, y, r, r + 3, 'o')
        p(h, T, (x, y, r, r + 2))
def loop():
    c = 1
    while 1:
        x = next(hc) + H
        y = next(vc) + (V // 2)
        r = next(rc)
        c += 3
        c %= H
        x += c
        y += c
        #h.circle(x,y,r,r+2,'o') move to p
        m = 'c: %d, x:%d,y:%d, r:%d, R:%d, len(keep):%d' % (c, x, y, r, r + 2,
                                                            len(keep))
        ca = (x, y, r, r + 2, 'o')
        #p(h,ca,T,m)
        keep.append((ca, m))
        while len(keep) > mk:
            del (keep[0])
        h = hexy.Hexy(H, V)
        for ca, m in keep:
            p(h, ca, m)
Exemple #6
0
import time
import hexy
from itertools import cycle


def p(h, t, s):
    click.clear()
    print(h.show())
    print(s)
    time.sleep(t)


n = 81
H, V = n, n
T = 0.03
h = hexy.Hexy(H, V)


def roundrange(b, e):
    while True:
        for i in range(b, e):
            yield i
        for i in range(e, b - 1, -1):
            yield i


vc = cycle(roundrange(-V // 2, V // 2))
hc = cycle(roundrange(-H // 2, H // 2))
rc = cycle(roundrange(1, 4 * V))

Exemple #7
0
import click
import time
import hexy
h = hexy.Hexy(34, 31)

h.draw(18, 2, 3)
h.draw(5, 14, 3)
h.draw(18, 26, 3)
h.draw(43, 26, 3)
h.draw(56, 14, 3)
h.draw(43, 2, 3)


def hline(x, y, c, s, d):
    for i in range(s, s + 1):
        h.line(x, y, c, i, d)
        click.clear()
        print(h.show())
        time.sleep(0.02)


def doloop(a=1):
    for i in range(a):
        hline(20, 6, "/", 8, "Z")
        hline(11, 18, "\\", 8, "Y")
        hline(25, 28, "_", 8, "X")
        hline(49, 27, "/", 8, "z")
        hline(58, 15, "\\", 8, "y")
        hline(44, 4, "_", 8, "x")
        click.clear()
        print(h.show())
Exemple #8
0
import hexy
import hexy.util.nrange
h = hexy.Hexy(x=10, y=10)
for i in hexy.util.nrange.nrange(10, 100, 3):
    h.draw(1, 2, i)
    print(h.show())
for f in h.grid:
    for i in f:
        print(len(i._hist))
Exemple #9
0
import hexy
import click
import time

def do(f,a):
 print(f,a)
 r=f(*a)
 time.sleep(0.01)
 click.clear()
 print(h.show())
 return r

#h=hexy.Hexy(x=27,y=21)
#print(h.show())
h=hexy.Hexy(27,21)
print(h.show())
for i in range(1,183):
 for d in 'XYZxyz':
  do(h.line,(0,0,d,i,d))


#%history?
#%history -f xyz.ipy
Exemple #10
0
import time
import click

import hexy
import stop_and_thanks

dp = 'XYZxyz'  #directions path


def dpm(s):  # '' multiply
    r = ''
    s -= 1
    for c in dp:
        r += s * c
    #print(s,r)
    #time.sleep(1)
    return r


for i in range(2, 111, 3):
    h = hexy.Hexy(42, 27)
    hexy.grid.grid_add_hexagon(h.grid, 12, 6, i, dpm(i))
    click.clear()
    print(h.show())
    time.sleep(0.3)
Exemple #11
0
import hexy
import click
import time

h = hexy.Hexy(42, 42)
print(h.show())
#%history -f xyz.py
for d in 'XYZxyz':
    click.clear()
    time.sleep(0.5)
    h.line(0, 0, d, 42, d)
    print(h.show())
Exemple #12
0
import click
import time
import hexy
h=hexy.Hexy(34,34)
#print(h.show())
#h.draw(17,1,17)
h.draw(18,2,3)
h.draw(5,15,3)
h.draw(18,28,3)
h.draw(44,28,3)
h.draw(57,15,3)
h.draw(44,2,3)
print(h.show())
#time.sleep(3)
#for i in range(2,15):
#    h.draw(i,i,i)
#    print(h.show())