This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
pygame.init() | |
# 1 = en haut à droite | |
# 2 = en bas à droite | |
# 3 = en bas à gauche | |
# 4 = en haut à gauche | |
l_écran = 400 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as p | |
import random | |
R,r,W,H,G,N=range,random.randrange,480,320,3,5 | |
g=[[r(W),r(H),r(W),r(H)]+[r(-9,9,2)for _ in R(4)] for _ in R(G)] | |
p.init() | |
s=p.display.set_mode((W,H)) | |
f=lambda n,d,L:(n+(d:=d*(-1 if n+d not in R(L)else 1)),d) | |
while 1: | |
s.fill([0]*3) | |
for i,l in enumerate(g): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canvas = document.getElementById('lines'); | |
const ctx = canvas.getContext('2d'); | |
const W = canvas.width; | |
const H = canvas.height; | |
const G = 4, N = 6; | |
const rand = (max, step = 1) => Math.floor(Math.random() * max / step) * step; | |
const next = (line, vel) => line.map((p, i) => (vel[i] *= (p + vel[i] >= 0 && p + vel[i] < (i % 2 ? H : W)) ? 1 : -1, p + vel[i])); | |
const drawLines = (lines, ctx) => lines.forEach(l => ctx.stroke(new Path2D(`M ${l[0]} ${l[1]} L ${l[2]} ${l[3]}`))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as p | |
import random as m | |
R=range | |
r=m.randrange | |
S=(480,320) | |
def n(l,v): | |
for i in R(4): | |
v[i]*=-1+2*(l[i]+v[i]in R(S[i%2])) | |
return[l[i]+v[i]for i in R(4)] | |
V=[[r(-9,9,2)]*4for _ in R(5)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as pg | |
import random as r | |
W, H = 800, 600 | |
G, L = 4, 6 | |
def next(l, v): | |
for i in range(4): | |
v[i] *= 1 if l[i] + v[i] in range(W if i % 2 == 0 else H) else -1 | |
return [l[i] + v[i] for i in range(4)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import random | |
WIDTH = 800 | |
HEIGHT = 600 | |
NB_GROUPS = 5 | |
HISTO_SIZE = 8 | |
LINE_COLOR = (255,255,255) | |
BKG_COLOR = (0,0,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import random | |
WIDTH, HEIGHT = 800, 600 | |
NB_GROUPS, NB_LINES_PER_GROUP = 4, 6 | |
vectors, lines = [], [] | |
def next(l, v): | |
for i in range(4): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reproduce an early 90s Macintosh screensaver | |
# Nicolas Seriot 2024-11-13 https://seriot.ch | |
# https://x.com/nst021/status/1856605627264417931 | |
import pygameimport pygame | |
import random | |
WIDTH = 800 | |
HEIGHT = 600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
<meta name="generator" content="Adobe GoLive 4"> | |
<title>grands textes de linguistique slave</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(0, int(largeur/2.)): | |
for j in range(0, int(hauteur/2.)): | |
# coordonnées du coin haut gauche | |
# pour chaque groupe de 4 pixels | |
coin_x = i*2 | |
coin_y = j*2 | |
print(coin_x, coin_y) |