This file contains 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 Graphics.Gloss | |
main = animate (InWindow "Tree" (500, 650) (20, 20)) | |
black (picture 4) | |
picture :: Int -> Float -> Picture | |
picture degree time | |
= Translate 0 (-300) | |
$ tree degree time (dim $ dim brown) | |
stump :: Color -> Picture | |
stump color | |
= Color color |
This file contains 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
from functools import partial | |
from math import pi | |
import tv3d | |
tv3d.open(camdist=80,camangle=(pi/2,0,0),camrotspeed=(0,0.4,0),fov=15,addr='localhost:2541') | |
def draw(f,v,i): | |
r = f(v,i) | |
tv3d.releaseobjects() | |
tv3d.createmeshobject([f for xyz in v for f in xyz],i) | |
tv3d.sleep(0.2) | |
return r |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# An RC car sim prototype using physical motors for control. | |
from trabant import * | |
# ASCII geometry. | |
paddle = r''' | |
^ ^ | |
<XXXXXXXXXXX> |
This file contains 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
from trabant import * | |
create_box(side=(6,1,1), mat='flat', static=True) | |
create_box((0,0,-.5), side=(1.5,1,6), mat='flat', static=True) | |
while loop(): taps() |
This file contains 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
# A minimal 22 LoC Minecraft imitation for the Trabant API (pixeldoctrine.com/trabant.html). | |
# Note that this is made for computers and no touch controls are included. | |
from trabant import * | |
# draw all shapes filled | |
fg(outline=False) | |
# floor | |
for y in range(5): |
This file contains 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
#!/usr/bin/env python3 | |
from progwar.client import my_tanks,join_game | |
from math import atan2,atan | |
def closest_tank(pos, tanks): | |
return min(tanks, default=None, key=lambda t:(t.pos-pos).length()) | |
def update(blips): |
This file contains 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
#!/usr/bin/env python3 | |
'''A simple precognition PRNG game. Press left or right on the keyboard and try to predict the next turn.''' | |
from math import factorial | |
from random import choice | |
from trabant import * | |
houses = {} | |
moving = True |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from trabant import * | |
from trabant.gameapi import setvar,waitload | |
text = ''' | |
xxx | |
x x xx xx xxx | |
x x x x x x x x x |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Doom prototype. | |
from trabant import * | |
import trabant | |
from trabant.packstr import unpack | |
from math import sin,fmod | |
from time import time |
This file contains 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
#!/usr/bin/env python3 | |
from sys import byteorder | |
from zlib import compress,decompress | |
def stringify(b): | |
i = int().from_bytes(b, byteorder) | |
s = '' | |
while i: |