tanasinnの謎は深まるばかりだ……

Windowsでの動作報告希望。

import sys
import pygame
import random
import math as m
from pygame.locals import *

pygame.init()
clock = pygame.time.Clock()
SCREENWIDTH = 288
SCREENHEIGHT = 512
surf = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT), pygame.SCALED | pygame.FULLSCREEN)
pygame.display.set_caption('*tanasinn*')

val = -1.0
# print('*** tanasinn == -1 ***')

BAI = 64

VAL = 777
VAL = -1.0

myfont = pygame.font.SysFont("Arial", 32)

def painttxt(str):
  global surf, label, myfont
  label = myfont.render(str, 1, (255,255,0))
  surf.blit(label, (0, 0))

DEFY = 256
lines = []

class CLine:
  def __init__(self, x, y, x2, y2):
    self.x = x
    self.y = y
    self.x2 = x2
    self.y2 = y2
    
def make_lines():
  global lines
  lines.clear()
  oldx = 0
  olda = 0
  for i in range(1, 280):
    xfog = i
    sinn = m.sin(xfog)
    if (sinn == 0.0):
      sinn = 0.0001
    tana = VAL / sinn
    p = tana
    a = m.atan(p)
    lines.append(CLine(oldx, olda, xfog, a))
    oldx = xfog
    olda = a

def drawit():
  for o in lines:
    pygame.draw.line(surf, (255, 255, 0), (o.x*10,o.y*BAI+DEFY), (o.x2*10, o.y2*BAI+DEFY))

while True:
    for ev in pygame.event.get():
        if ev.type == QUIT:
            pygame.quit()
    clock.tick(10)
    make_lines()
    surf.fill((0, 0, 0))
    VAL += random.uniform(-0.1, 0.1)
    if VAL == 0.0:
      VAL = 0.0000001
    drawit()
    painttxt('tanasinn...')
    pygame.display.flip()

f:id:kokarage:20200905015957j:plain