free software resistance
the cost of computing freedom is eternal vigilance
### sines.py
*original date:* sep 2010
*originally posted:* sep 2024
this is a cool program i wrote for basic, and one of the first i ported to use python with pygame.
these days i port to fig instead, and insted of bothering with pygame (which older versions of fig support), i let fig abstract the pset command to ansi output instead of pygame. the original version of fig would do this too, but would use pygame if it was installed:
```
#!/usr/bin/env python
# new sines demo
# 2006, 2009 mennonite
# public domain
import pygame
import random
import time
import math
pygame.init() ; game = pygame.display.set_mode([640, 480])
def cquit():
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
return 1
elif event.type == pygame.QUIT:
return 1
return 0
ink, kpp = 2, 0
x, y, f = 0, 0, 0
bcx, bcy, bcz, bx, by = 0, 0, 0, 100, 100
z = float(1)
while z <= 190:
x = float(-3.14)
while x <= 3.14:
bx += 1
if float(bx) / 2 == int(bx / 2):
ink = 28
bcz = bcz + ink
if bcz > 255: bcz = 0 ; bcy = bcy + ink
if bcy > 255: bcy = 0 ; bcx = bcx + ink
if bcx > 255: bcx = 0 ; bcy = 0 ; bcz = 0
f = f + float(1 / 2 ** 22)
y = math.sin(x * 8) * 10 + math.sin(z / 4 * float(x) / 1.5) * 10
rcx = int(x * 100 + math.sin(z * 8) + z)
rcy = int(float(y + 25 + z) / (1 + f))
pygame.draw.circle(game, (bcx, bcy, bcz), [rcx*2, rcy*2], 10)
x += float(1) / 2 ** 7
pygame.display.update()
if cquit():
exit()
z += float(1) / 2 ** 3
while cquit() == 0:
pass #wait to close
```
license: 0-clause bsd
```
# 2006, 2009, 2010 mn
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org