Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
95dad1a
create and update command parsing
aidanhb Oct 26, 2019
9c02fe0
Merge remote-tracking branch 'aidan/tinytalk' into tinytalk
ryanprior Oct 26, 2019
fc8f6bc
Updates TinyTalk grammar
ryanprior Oct 26, 2019
e257501
Adds property based testing for some grammars
ryanprior Oct 27, 2019
b5866aa
Adds tests for exprs, fixes some grammar rules
ryanprior Oct 28, 2019
491e802
Adds comments for structure and clarity
ryanprior Oct 28, 2019
178d61a
Adds tests for match, create, update
ryanprior Oct 28, 2019
e00eee8
Ignores .hypothesis cache directory
ryanprior Oct 28, 2019
b7bf53d
Tests visitors for a few types, adds inequality visitor
ryanprior Oct 28, 2019
0f6114a
Merge branch 'tinytalk' of https://github.com/tinylanders/tinyland in…
aidanhb Oct 28, 2019
5a6728a
Merge remote-tracking branch 'ryan/tinytalk' into tinytalk
aidanhb Oct 28, 2019
d43a7af
add pytests for rules
aidanhb Oct 29, 2019
9d3eb12
Add tests for parsing create, update, app rules and more
aidanhb Oct 30, 2019
f626119
Condition and match interpreter implementation.
aidanhb Nov 13, 2019
7463986
App scene manipulation based on dict scene
aidanhb Nov 16, 2019
e4e5a74
App scene manipulation based on dict scene
aidanhb Nov 16, 2019
81549df
Merge branch 'tinytalk' of https://github.com/aidanhb/tinyland into t…
aidanhb Nov 17, 2019
26a91d5
basic test passes
aidanhb Nov 19, 2019
3ad33e1
add basic websocket server
aidanhb Nov 20, 2019
59bb840
Create server that listens for tinyland changes and serves the tinyla…
aidanhb Nov 22, 2019
f70a51c
Improved and refactored Websocket Server and tinyland runtime.
aidanhb Dec 8, 2019
c5fbd14
Add more grammar!
aidanhb Dec 10, 2019
caa163a
⚠️ Work in progress on ReacTIVision + Tinytalk
Dec 12, 2019
275a17e
Integrate with actual OSC messages over UDP
aidanhb Dec 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
config.toml
__pycache__/
__pycache__/
tinytalk/.hypothesis
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ opencv-contrib-python==4.1.1.26
toml==0.10.0
deep_merge==0.0.4
parsimonious==0.8.1
black==19.3b0
hypothesis==4.41.3
pytest==5.2.2
pytest-xdist==1.30.0
mysql-connector-python==8.0.17
websockets==8.1
python-osc==1.7.4
29 changes: 0 additions & 29 deletions tinytalk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
from . import data
from .grammar import grammar, TinyTalkVisitor

def dump():
print("database dump:")
print(names)

def read_tiny_talk(s):
print(f"***** reading {s}")
tree = grammar.parse(s)
print("***** the parse tree")
print(tree)
visitor = TinyTalkVisitor()
output = visitor.visit(tree)
print("***** output")
print(output)

def init_database():
data.commit("aruco", "visible", {"id": 111, "x": 0, "y": 0})


def run():
print("running simulation")
init_database()
data.commit("aruco", "visible", {"x": 10, "y": 1})
print(data.query('aruco'))
print("done")


# sample tinytalk programs

# syntax for data:
Expand Down
27 changes: 27 additions & 0 deletions tinytalk/_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import grammar
import interpreter

app = "when [#marker x y] as m create [#ball x: m.y, y: m.x]"

tree = grammar.grammar.parse(app)
visitor = grammar.TinyTalkVisitor()
app_json = visitor.visit(tree)

scene = {
"appMarkers": {
"1": {
"type": "marker",
"x": 50,
"y": 0,
}
},
"virtualObjects": {
}
}

print(app_json)

new_scene = interpreter.run(app_json, scene)

print(scene)
print(new_scene)
31 changes: 31 additions & 0 deletions tinytalk/app.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ======= BALL APP =======
// Create ball when we see ball
when (#ball ) as m create (#blob x: m.x, y: m.y, point: [m.x, m.y], size: 10, vy: 0.005, vx: 0.005)


// Change ball velocity when we hit a wall
when (#blob y where y > 1.0) as b update b (y: 0.99, vy: b.vy * -1, point: [b.x, 0.95])

when (#blob y where y < 0.0) as b update b (y: 0.01, vy: b.vy * -1, point: [b.x, 0.05])

when (#blob x where x > 1.0) as b update b (x: 0.99, vx: b.vx * -1, point: [0.95, b.y])

when (#blob x where x < 0.0) as b update b (x: 0.01, vx: b.vx * -1, point: [0.05, b.y])


// Update ball position based on velocity
when (#blob x y) as b update b (x: b.x + b.vx y: b.y + b.vy, point: [b.x + b.vx, b.y + b.vy])


// ======= PADDLE APP =======
// Create paddle when we see marker
when (#marker ) as m create (#line x: m.x, ya: m.y + 0.05, yb: m.y - 0.05, points: [[m.x, ya], [m.x, yb]])


// Update paddle line based on marker
when (#marker x y) as m;
(#line x ya yb) as l
update l (x: m.x,
ya: m.y + 0.05,
yb: m.y - 0.05,
points: [[l.x, l.ya], [l.x, l.yb]])
16 changes: 0 additions & 16 deletions tinytalk/data.py

This file was deleted.

Loading