[fractale module] added von_kock and blanc_manger
This commit is contained in:
parent
b8926d4265
commit
28f7e0ea1d
@ -1,8 +1,9 @@
|
||||
#dummy module
|
||||
import asyncio
|
||||
import fractale.source.betterTurtle
|
||||
import fractale.source.main
|
||||
import random
|
||||
import discord
|
||||
from PIL import Image
|
||||
class MainClass():
|
||||
def __init__(self, client, modules, owners, prefix):
|
||||
self.client = client
|
||||
@ -17,13 +18,29 @@ class MainClass():
|
||||
self.interactive=True
|
||||
self.color=0x78ffc3
|
||||
self.help="""\
|
||||
</prefix>fractale
|
||||
=> Génère une image fractale.
|
||||
</prefix>fractale [fractale] [nombre d'itérations]
|
||||
=> Génère une image fractale. (Si on met le nombre d'itérations, on doit mettre le nom de la fractale.)
|
||||
|
||||
[fractale]
|
||||
...: von_koch
|
||||
...: blanc_manger
|
||||
"""
|
||||
async def on_message(self, message):
|
||||
args=message.content.split(" ")
|
||||
tmpstr="/tmp/%s.png"%random.randint(1,10000000)
|
||||
t = fractale.source.betterTurtle.Turtle(size=(10000, 10000), resolution=1)
|
||||
t.set_position((0, 0))
|
||||
t.fractal.outline(8, 40, 4)
|
||||
t.save(tmpstr)
|
||||
im=Image.new('RGB', (5000, 5000), (0, 0, 0))
|
||||
fig = fractale.source.main.Figures(im=im)
|
||||
if len(args)==1 :
|
||||
fig.von_koch_curve_flake((2500, 2500), 2000, 5)
|
||||
elif args[1].lower()=="blanc_manger" :
|
||||
iterations=7
|
||||
if len(args)>2 and int(args[2])<=20:
|
||||
iterations=int(args[2])
|
||||
fig.blanc_manger((1000, 1000), (4000, 4000), iterations)
|
||||
elif args[1].lower()=="von_koch" :
|
||||
iterations=5
|
||||
if len(args)>2 and int(args[2])<=7:
|
||||
iterations=int(args[2])
|
||||
fig.von_koch_curve_flake((2500, 2500), 2000, iterations)
|
||||
im.save(tmpstr)
|
||||
await message.channel.send(file=discord.File(tmpstr))
|
||||
|
@ -12,7 +12,7 @@ class MainClass():
|
||||
self.name="Restart"
|
||||
self.description="Module gérant les redémarrages du bot"
|
||||
self.interactive=True
|
||||
self.authlist=[549662392120901633]
|
||||
self.authlist=[]
|
||||
self.color=0x000000
|
||||
self.help="""\
|
||||
</prefix>restart
|
||||
|
Loading…
Reference in New Issue
Block a user