Left click difficult
Right click easy
This commit is contained in:
parent
76b58cde48
commit
e1190e0df6
16
hijfong.py
16
hijfong.py
@ -5,10 +5,11 @@ import random
|
|||||||
#import seaborn as sns
|
#import seaborn as sns
|
||||||
#import pandas as pd
|
#import pandas as pd
|
||||||
#import numpy as np
|
#import numpy as np
|
||||||
|
import math
|
||||||
|
|
||||||
from Tkinter import *
|
from Tkinter import *
|
||||||
|
|
||||||
|
# (c) R P Clark 2019
|
||||||
def redrawAll(canvas):
|
def redrawAll(canvas):
|
||||||
canvas.delete(ALL)
|
canvas.delete(ALL)
|
||||||
# draw a red rectangle on the left half
|
# draw a red rectangle on the left half
|
||||||
@ -33,7 +34,7 @@ def leftclick(event):
|
|||||||
if mm < 21 and mm > 2:
|
if mm < 21 and mm > 2:
|
||||||
print "you are in the CHAOS zone "
|
print "you are in the CHAOS zone "
|
||||||
print "Stability factor=",mm," x=",ro,"y=",io
|
print "Stability factor=",mm," x=",ro,"y=",io
|
||||||
if mm > 20 and mm < 80:
|
if mm > 75 and mm < 80:
|
||||||
print "you found the RAGGED EDGE OF CHAOS YOU WON PLAYER 2"
|
print "you found the RAGGED EDGE OF CHAOS YOU WON PLAYER 2"
|
||||||
draw_complete()
|
draw_complete()
|
||||||
def rightclick(event):
|
def rightclick(event):
|
||||||
@ -74,13 +75,18 @@ root.canvas = canvas.canvas = canvas
|
|||||||
canvas.data = { }
|
canvas.data = { }
|
||||||
redrawAll(canvas)
|
redrawAll(canvas)
|
||||||
|
|
||||||
# (c) R P Clark 2019
|
rot = random.randint(-1570, 1570) / 1000.0
|
||||||
|
zz = complex(math.cos(rot), math.sin(rot))
|
||||||
|
print " rotation ", rot, "degrees ", 90*rot/1.57, "zz ", zz
|
||||||
def mandelbrot (re, Im, max_iter):
|
def mandelbrot (re, Im, max_iter):
|
||||||
c = complex (Re,Im)
|
c = complex (Re,Im)
|
||||||
|
print " complex c ",c
|
||||||
|
c = c * zz
|
||||||
|
print " complex c after rotaion with zz",zz, " c is now ", c
|
||||||
z = 0.0j
|
z = 0.0j
|
||||||
for i in range (max_iter):
|
for i in range (max_iter):
|
||||||
c = complex(re,Im)
|
c = complex(re,Im)
|
||||||
|
c = c * zz
|
||||||
z = z * z + c
|
z = z * z + c
|
||||||
if ( z.real * z.real + z.imag * z.imag) > 4:
|
if ( z.real * z.real + z.imag * z.imag) > 4:
|
||||||
return i
|
return i
|
||||||
@ -93,6 +99,8 @@ def get_col(mm):
|
|||||||
return "blue"
|
return "blue"
|
||||||
if ( mm > 80 ):
|
if ( mm > 80 ):
|
||||||
return "green"
|
return "green"
|
||||||
|
if ( mm > 80 ):
|
||||||
|
return "lightgreen"
|
||||||
if ( mm > 60 ):
|
if ( mm > 60 ):
|
||||||
return "cyan"
|
return "cyan"
|
||||||
if ( mm > 30 ):
|
if ( mm > 30 ):
|
||||||
|
Loading…
Reference in New Issue
Block a user