Skip to content

Commit

Permalink
demos: Remove trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aliceisjustplaying committed Aug 26, 2024
1 parent 52bcf39 commit 38ec136
Show file tree
Hide file tree
Showing 19 changed files with 151 additions and 151 deletions.
60 changes: 30 additions & 30 deletions demos/benchmark.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
local runningTime = 0
local t = 0
local RUNNER = {}
-- predictable random
-- predictable random
-- give the same sequence every time
local random = {}
random.max = 8000
random.count = 0
for x=0,random.max do
for x=0,random.max do
random[x+1] = math.random(100)/100
end
function Random(v)
random.count = random.count+1
return random[(random.count%random.max)+1] * v
return random[(random.count%random.max)+1] * v
end

-- epilepsy warning
Expand Down Expand Up @@ -57,15 +57,15 @@ function UI:mainmenu()
cls(1)
print("Let the test run until the bar is full",0,0,15)

-- print position
-- print position
local yp = 68-((#UI.options*8)/2)
-- what is selected
local currentOption = 1+(UI.currentOption % (#UI.options))
-- display options
for o=1,#UI.options do
for o=1,#UI.options do
color = 6
opt = UI.options[o]
if o==currentOption then
if o==currentOption then
color = 15
-- if highlighted and press Z
-- then start it
Expand All @@ -74,7 +74,7 @@ function UI:mainmenu()
RUNNER = opt[2]
-- if we have an INIT then run it
random.count = 0
if RUNNER.init ~= nil then
if RUNNER.init ~= nil then
RUNNER:init()
end
RUNNER.count = 0
Expand Down Expand Up @@ -102,8 +102,8 @@ end
function SQRT:run()
cls(0)
local wiggle= t/20 % 20
for y=0,136 do
for x=0,RUNNER.count do
for y=0,136 do
for x=0,RUNNER.count do
pix(x%240,y,16-(math.sqrt(wiggle+(x*x + y*y)/136)%16))
end
end
Expand All @@ -116,8 +116,8 @@ end
function SINCOS:run()
cls(0)
local wiggle= t/20 % 20
for y=0,136 do
for x=0,RUNNER.count do
for y=0,136 do
for x=0,RUNNER.count do
local v = 0
v = v + math.sin(wiggle+x) + math.cos(wiggle+y)
v = v + math.cos(wiggle-y) + math.sin(wiggle-x)
Expand All @@ -134,8 +134,8 @@ function PIXELRW:init()
end
function PIXELRW:run()
local wiggle= t/20 % 120
for y=0,136 do
for x=0,RUNNER.count do
for y=0,136 do
for x=0,RUNNER.count do
local a = pix(x+wiggle,y)
local b = Random(100)
if b<25 then
Expand All @@ -152,8 +152,8 @@ local PIXELW = { add = 5 , callmult = 1}
function PIXELW:init()
end
function PIXELW:run()
for y=0,136 do
for x=0,RUNNER.count do
for y=0,136 do
for x=0,RUNNER.count do
pix(x&0xff,y,32+(x+(y*8)))
end
end
Expand All @@ -163,7 +163,7 @@ end
local MATHRANDOM = { add = 1000 , callmult = 2}
function MATHRANDOM:run()
cls(0)
for rc=0,RUNNER.count do
for rc=0,RUNNER.count do
pix(math.random(240),math.random(136),math.random(15))
end
end
Expand All @@ -172,17 +172,17 @@ end
local SHAPES = { add = 25, callmult = 1}
function SHAPES:run()
cls(2)
for x=0,RUNNER.count do
for x=0,RUNNER.count do
circ(Random(240),Random(136),Random(16),x&1)
end
end

-- map
-- map

local MAP = { add = 1 , callmult = 1}
function MAP:run()
cls(10)
for x=0,RUNNER.count do
for x=0,RUNNER.count do
map(0,0,30,18,-x,0,10)
end
end
Expand All @@ -193,7 +193,7 @@ local Sprites = { add = 100 , callmult = 1}
function Sprites:run()
local a = t + 1/RUNNER.count
cls(0)
for x=0,RUNNER.count do
for x=0,RUNNER.count do
spr(1,120+math.sin(x+a)*120,68+math.cos(x-a)*68)
end
end
Expand All @@ -209,7 +209,7 @@ function Particles:run()
table.sort(Particles, function(a,b) return a.y>b.y end)

if (t//40)&1==0 then
if runningTime<16.2 then
if runningTime<16.2 then
for x=1,100 do
table.insert(Particles.list,{x=Random(240),y=-Random(32),c=1+((x//10)%14),fs=0.5+Random(5)/10.0})
end
Expand All @@ -218,16 +218,16 @@ function Particles:run()

Particles.count = #Particles.list

for x=1,#Particles.list do
for x=1,#Particles.list do
p = Particles.list[x]
if p.y<100 then
if (pix(p.x,(p.y+p.fs)//1)==0) then
if (pix(p.x,(p.y+p.fs)//1)==0) then
p.y=p.y+p.fs
else
if Random(100)>80 then
if (pix(p.x-1,p.y+1)==0) then
if (pix(p.x-1,p.y+1)==0) then
p.x = p.x-1
elseif (pix(p.x+1,p.y+1)==0) then
elseif (pix(p.x+1,p.y+1)==0) then
p.x = p.x+1
end
end
Expand Down Expand Up @@ -256,12 +256,12 @@ RUNNER = nil

function MAINTIC()
local stime = time()
if RUNNER~=nil then
if RUNNER~=nil then
if RUNNER.count~=nil then
if runningTime<16.6 then
if runningTime<16.6 then
RUNNER.count=RUNNER.count + RUNNER.add
end
if runningTime>18.0 then
if runningTime>18.0 then
RUNNER.count=RUNNER.count - RUNNER.add
end
print(RUNNER.count,0,110,15)
Expand All @@ -274,7 +274,7 @@ function MAINTIC()

print(string.format("runTime %.2f",runningTime),1,127,0)
print(string.format("runTime %.2f",runningTime),0,126,15)
if runningTime>16 then
if runningTime>16 then
UI:bench()
end
end
Expand All @@ -294,7 +294,7 @@ function TIC()
t=t+1
if (t>60*2) then
UI:bench()
if btnp(4) then
if btnp(4) then
TIC=MAINTIC
end
end
Expand Down
4 changes: 2 additions & 2 deletions demos/bpp.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- title: Blit segment demo cart
-- author: ddelemeny
-- desc: Variable BPP rendering
-- desc: Variable BPP rendering
-- script: lua

W=16*4
Expand Down Expand Up @@ -84,7 +84,7 @@ function TIC()
-- font inverts BG and FG segments
-- blit segment = 8+4+page
rText(text, 100, 60, 8+4+sel//2,sel%2==1)
end
end

-- <TILES>
-- 032:0020505000205070002000500000007000200050000000000000000000000000
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/jsmark.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// title: Bunnymark in JavaScript
// author: Rob Loach
// desc: Benchmarking tool to see how many bunnies can fly around the screen, using JavaScript.
// license: MIT License
// license: MIT License
// input: gamepad
// script: js
// version: 1.1.0
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/moonmark.moon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- title: Bunnymark in MoonScript
-- author: Rob Loach
-- desc: Benchmarking tool to see how many bunnies can fly around the screen, using MoonScript.
-- license: MIT License
-- license: MIT License
-- input: gamepad
-- script: moon
-- version: 1.1.0
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/pythonmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# input: gamepad
# script: python
# version: 0.0.0
import random
import random

screen_width = 240
screen_height = 136
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/rubymark.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# title: Bunnymark in Ruby
# author: Julia Nelz; based on the original work of Rob Loach
# desc: Benchmarking tool to see how many bunnies can fly around the screen, using Ruby.
# license: MIT License
# license: MIT License
# input: gamepad
# script: ruby
# version: 0.1.0
Expand Down
4 changes: 2 additions & 2 deletions demos/bunny/schememark.scm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;; title: Bunnymark in Scheme
;; author: David St-Hilaire, based on the original work of Rob Loach
;; desc: Benchmarking tool to see how many bunnies can fly around the screen, using Scheme.
;; license: MIT License
;; license: MIT License
;; input: gamepad
;; script: scheme
;; version: 1.1.0
Expand All @@ -13,7 +13,7 @@

(define (randomFloat lower greater) (+ (random (- greater lower) lower)))

(defstruct bunny
(defstruct bunny
(w 26)
(h 32)
(x (floor (random (- screenWidth 26))))
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/squirrelmark.nut
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// title: Bunnymark in Squirrel
// author: Rob Loach
// desc: Benchmarking tool to see how many bunnies can fly around the screen, using Squirrel.
// license: MIT License
// license: MIT License
// input: gamepad
// script: squirrel
// version: 1.1.0
Expand Down
Binary file modified demos/bunny/wasmmark/wasmmark.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions demos/bunny/wasmmark/wasmmark.wasmp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

"""""""""""""""""""""""""""""""""""""""

This is a WASM binary project, you
This is a WASM binary project, you
won't find the Zig source here.

For source code see the TIC-80
For source code see the TIC-80
repository folder:

/demos/bunny/wasmmark/
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/wrenmark.wren
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// title: Bunnymark in Wren
// author: Rob Loach
// desc: Benchmarking tool to see how many bunnies can fly around the screen, using Wren.
// license: MIT License
// license: MIT License
// input: gamepad
// script: wren
// version: 1.1.0
Expand Down
6 changes: 3 additions & 3 deletions demos/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fov=100
mesh={} -- Table that contains all the 3D points
polygon={} -- Table that contains all connections of 3D points to create triangle polygons, with their texture specified too
zorder={} -- Table used to know the rendering order of the triangles
rspeed=.1 -- Rotation speed, you can change it
rspeed=.1 -- Rotation speed, you can change it
tspeed=10 -- Translation speed, you can change it

function addMesh(mx,my,mz)
Expand Down Expand Up @@ -183,8 +183,8 @@ function showMesh()
p.u2,p.v2,
p.u3,p.v3,
0,{},
(m[p.p1].z+point.z),
(m[p.p2].z+point.z),
(m[p.p1].z+point.z),
(m[p.p2].z+point.z),
(m[p.p3].z+point.z))
end
end
Expand Down
20 changes: 10 additions & 10 deletions demos/fire.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function addParticle(x,y)
table.insert(particle,p)
end

function ticParticle()
function ticParticle()
--print("#"..#particle)
local s=0
local s2=0
Expand All @@ -39,37 +39,37 @@ function ticParticle()
--remove old ones
if p.t > 300 then
table.remove(particle,k)
end
end
end
end
end

function TIC()

if btn(0) then y=y-1 end
if btn(1) then y=y+1 end
if btn(2) then x=x-1 end
if btn(3) then x=x+1 end
if btn(3) then x=x+1 end

--warp space
x = x % 240
y = y % 136

--reset
if btn(4) then
if btn(4) then
x = 120
y = 120
end

addParticle(x,y)
addParticle(30,130)
addParticle(210,130)
addParticle(x,y)
addParticle(30,130)
addParticle(210,130)

cls(8)

--Update & Draw particles
--Update & Draw particles
ticParticle()

--cursor
--cursor
pix(x,y,7)

print("! FIRE !",94,64)
Expand Down
Loading

0 comments on commit 38ec136

Please sign in to comment.