Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webTAS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Florent Becker
webTAS
Commits
8d01892b
Commit
8d01892b
authored
Apr 10, 2026
by
Florent Becker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show time
parent
14a76a22
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
35 deletions
+46
-35
index.html
index.html
+9
-4
simulator.mjs
src/simulator.mjs
+19
-16
textmanager.mjs
src/textmanager.mjs
+7
-1
tileblock.mjs
src/tileblock.mjs
+7
-10
webtas.mjs
src/webtas.mjs
+4
-4
No files found.
index.html
View file @
8d01892b
...
@@ -34,11 +34,16 @@
...
@@ -34,11 +34,16 @@
<div
class=
"w3-dropdown-hover"
>
<div
class=
"w3-dropdown-hover"
>
<button
class=
"w3-button"
>
Settings
</button>
<button
class=
"w3-button"
>
Settings
</button>
<div
class=
"w3-dropdown-content w3-bar-block w3-card-4"
>
<div
class=
"w3-dropdown-content w3-bar-block w3-card-4"
>
<button
id=
"set-simulation-mode-menu"
class=
"w3-bar-item w3-button"
>
Set Simulation Mode
</button>
<button
id=
"set-simulation-mode-menu"
class=
"w3-bar-item w3-button"
>
Set Simulation Mode
</button>
<button
id=
"set-temperature-button"
class=
"w3-bar-item w3-button"
>
Set Temperature
</button>
<button
id=
"set-temperature-button"
class=
"w3-bar-item w3-button"
>
Set Temperature
</button>
<input
id=
"report-nondeterminism-checkbox"
name=
"report-nondeterminism-checkbox"
type=
"checkbox"
value=
"report-nondeterminism"
checked
/>
<span
class=
"w3-bar-item"
>
<label
for=
"report-nondeterminism-checkbox"
>
Report Nondeterminism
</label>
<input
id=
"report-nondeterminism-checkbox"
name=
"report-nondeterminism-checkbox"
type=
"checkbox"
value=
"report-nondeterminism"
checked
/>
<label
for=
"report-nondeterminism-checkbox"
>
Report Nondeterminism
</label>
</span>
<span
class=
"w3-bar-item"
>
<input
id=
"show-attach-time-checkbox"
name=
"show-attach-time-checkbox"
type=
"checkbox"
value=
"show-attach-time"
checked
/>
<label
for=
"show-attach-time-checkbox"
>
Show Attachment Times
</label>
</span>
<button
id=
"set-background-color-button"
class=
"w3-bar-item w3-button"
>
Set Background Color
</button>
<button
id=
"set-background-color-button"
class=
"w3-bar-item w3-button"
>
Set Background Color
</button>
<input
id=
"bg-color-input"
type=
"color"
value=
"#ffffee"
style=
"display: none;"
/>
<input
id=
"bg-color-input"
type=
"color"
value=
"#ffffee"
style=
"display: none;"
/>
...
...
src/simulator.mjs
View file @
8d01892b
...
@@ -364,7 +364,7 @@ export class Simulator {
...
@@ -364,7 +364,7 @@ export class Simulator {
this
.
selectedTile
.
resize
();
this
.
selectedTile
.
resize
();
}
}
render
()
{
render
(
include_times
=
false
)
{
if
(
this
.
renderUpdate
)
{
if
(
this
.
renderUpdate
)
{
this
.
renderUpdate
=
false
;
this
.
renderUpdate
=
false
;
...
@@ -377,7 +377,9 @@ export class Simulator {
...
@@ -377,7 +377,9 @@ export class Simulator {
this
.
camera
.
position
.
y
+
this
.
camera
.
bottom
/
this
.
camera
.
zoom
).
round
();
this
.
camera
.
position
.
y
+
this
.
camera
.
bottom
/
this
.
camera
.
zoom
).
round
();
const
screenMax
=
new
Vector2D
(
this
.
camera
.
position
.
x
+
this
.
camera
.
right
/
this
.
camera
.
zoom
,
const
screenMax
=
new
Vector2D
(
this
.
camera
.
position
.
x
+
this
.
camera
.
right
/
this
.
camera
.
zoom
,
this
.
camera
.
position
.
y
+
this
.
camera
.
top
/
this
.
camera
.
zoom
).
round
();
this
.
camera
.
position
.
y
+
this
.
camera
.
top
/
this
.
camera
.
zoom
).
round
();
this
.
tileBlockAtlas
.
forTilesInRegion
(
screenMin
,
screenMax
,
TextManager
.
addTileGlyphs
);
this
.
tileBlockAtlas
.
forTilesInRegion
(
screenMin
,
screenMax
,
TextManager
.
addTileGlyphs
);
if
(
include_times
)
this
.
tileBlockAtlas
.
forTilesInRegion
(
screenMin
,
screenMax
,
TextManager
.
addTimeGlyphs
);
TextManager
.
update
(
this
.
scene
,
this
.
canvas
);
TextManager
.
update
(
this
.
scene
,
this
.
canvas
);
}
}
...
@@ -464,6 +466,7 @@ export class Simulator {
...
@@ -464,6 +466,7 @@ export class Simulator {
}
}
loadSystem
(
data
)
{
loadSystem
(
data
)
{
console
.
log
(
"before load, history: "
,
this
.
tileBlockAtlas
.
history
);
if
(
data
[
'tdp'
]
!==
undefined
&&
data
[
'tds'
]
!==
undefined
)
{
if
(
data
[
'tdp'
]
!==
undefined
&&
data
[
'tds'
]
!==
undefined
)
{
this
.
clear
();
this
.
clear
();
this
.
tileset
=
new
TileSet
();
this
.
tileset
=
new
TileSet
();
...
@@ -533,7 +536,6 @@ export class Simulator {
...
@@ -533,7 +536,6 @@ export class Simulator {
}
}
this
.
tileBlockAtlas
.
add_many
(
this
.
seedTiles
);
this
.
tileBlockAtlas
.
add_many
(
this
.
seedTiles
);
console
.
log
(
this
.
seedTiles
.
length
);
if
(
this
.
seedTiles
.
length
==
0
)
{
if
(
this
.
seedTiles
.
length
==
0
)
{
let
ttypes
=
this
.
tileset
.
tileTypes
;
let
ttypes
=
this
.
tileset
.
tileTypes
;
...
@@ -542,22 +544,23 @@ export class Simulator {
...
@@ -542,22 +544,23 @@ export class Simulator {
this
.
tileBlockAtlas
.
add
(
tile
,
origin
);
this
.
tileBlockAtlas
.
add
(
tile
,
origin
);
this
.
seedTiles
.
push
({
type
:
tile
,
coords
:
origin
});
this
.
seedTiles
.
push
({
type
:
tile
,
coords
:
origin
});
}
}
this
.
tileWorker
.
postMessage
({
msg
:
'set-seed'
,
seed
:
this
.
seedTiles
});
this
.
tileWorker
.
postMessage
({
msg
:
'set-seed'
,
seed
:
this
.
seedTiles
});
Logger
.
log
(
Logger
.
INFO
,
`loaded
${
this
.
simulation_mode
}
system file "
${
data
.
tdp
.
name
}
" with a seed of size
${
this
.
seedTiles
.
length
}
`
);
Logger
.
log
(
Logger
.
INFO
,
`loaded
${
this
.
simulation_mode
}
system file "
${
data
.
tdp
.
name
}
" with a seed of size
${
this
.
seedTiles
.
length
}
`
);
// Determine if we're in v1 or v2. V1 should use this.blockerDict and v2 should use this.tileset.tileGlueBlockers
// Determine if we're in v1 or v2. V1 should use this.blockerDict and v2 should use this.tileset.tileGlueBlockers
let
version_str
=
''
;
let
version_str
=
''
;
if
((
this
.
blockerDict
!==
undefined
)
&&
(
Object
.
keys
(
this
.
blockerDict
).
length
>
0
))
{
if
((
this
.
blockerDict
!==
undefined
)
&&
(
Object
.
keys
(
this
.
blockerDict
).
length
>
0
))
{
version_str
=
' (version 1: blockers specific to glue labels)'
;
version_str
=
' (version 1: blockers specific to glue labels)'
;
}
else
if
((
this
.
tileset
.
tileGlueBlockers
!==
undefined
)
&&
(
Object
.
keys
(
this
.
tileset
.
tileGlueBlockers
).
length
>
0
))
{
}
else
if
((
this
.
tileset
.
tileGlueBlockers
!==
undefined
)
&&
(
Object
.
keys
(
this
.
tileset
.
tileGlueBlockers
).
length
>
0
))
{
version_str
=
' (version 2: blockers specific to tile type sides)'
version_str
=
' (version 2: blockers specific to tile type sides)'
}
}
Logger
.
log
(
Logger
.
INFO
,
`simulation mode set to
${
this
.
simulation_mode
}${
version_str
}
`
);
Logger
.
log
(
Logger
.
INFO
,
`simulation mode set to
${
this
.
simulation_mode
}${
version_str
}
`
);
this
.
setTemperature
(
temp
);
this
.
setTemperature
(
temp
);
this
.
setState
(
STATE_DEFAULT
);
this
.
renderUpdate
=
true
;
this
.
setState
(
STATE_DEFAULT
);
this
.
renderUpdate
=
true
;
}
}
}
}
...
...
src/textmanager.mjs
View file @
8d01892b
...
@@ -37,6 +37,12 @@ export function clearText() {
...
@@ -37,6 +37,12 @@ export function clearText() {
}
}
}
}
export
function
addTimeGlyphs
(
tile
)
{
console
.
log
(
"adding time"
);
const
glyphData
=
;
}
export
function
addTileGlyphs
(
tile
)
{
export
function
addTileGlyphs
(
tile
)
{
const
glyphData
=
tileGlyphData
.
get
(
tile
.
type
.
id
);
const
glyphData
=
tileGlyphData
.
get
(
tile
.
type
.
id
);
...
@@ -636,4 +642,4 @@ export class TextManager {
...
@@ -636,4 +642,4 @@ export class TextManager {
return
data
;
return
data
;
}
}
}
}
\ No newline at end of file
src/tileblock.mjs
View file @
8d01892b
...
@@ -39,7 +39,7 @@ class TileBlock {
...
@@ -39,7 +39,7 @@ class TileBlock {
offset
.
y
>=
0
&&
offset
.
y
<
BLOCK_HEIGHT
;
offset
.
y
>=
0
&&
offset
.
y
<
BLOCK_HEIGHT
;
}
}
add
(
type
,
coords
)
{
add
(
type
,
coords
,
time
)
{
if
(
!
this
.
contains
(
coords
))
{
if
(
!
this
.
contains
(
coords
))
{
console
.
log
(
"ERROR: attempting to add tile to invalid tile block"
);
console
.
log
(
"ERROR: attempting to add tile to invalid tile block"
);
return
false
;
return
false
;
...
@@ -53,7 +53,7 @@ class TileBlock {
...
@@ -53,7 +53,7 @@ class TileBlock {
}
}
this
.
indexMap
[
key
]
=
this
.
tileData
.
length
;
this
.
indexMap
[
key
]
=
this
.
tileData
.
length
;
this
.
tileData
.
push
({
type
:
type
,
coords
:
coords
});
this
.
tileData
.
push
({
type
:
type
,
coords
:
coords
,
time
:
time
});
// there's a cleaner way to do this, but I'm lazy
// there's a cleaner way to do this, but I'm lazy
const
dummy
=
new
THREE
.
Object3D
();
const
dummy
=
new
THREE
.
Object3D
();
...
@@ -238,6 +238,7 @@ export class TileBlockAtlas {
...
@@ -238,6 +238,7 @@ export class TileBlockAtlas {
clear
()
{
clear
()
{
this
.
tileBlocks
=
new
Map
();
this
.
tileBlocks
=
new
Map
();
this
.
numTiles
=
0
;
this
.
numTiles
=
0
;
this
.
history
=
[];
// TODO: not entirely sure if geometry will be properly be deallocated
// TODO: not entirely sure if geometry will be properly be deallocated
// if memory leaks appear after clearing, start looking into this
// if memory leaks appear after clearing, start looking into this
...
@@ -254,7 +255,7 @@ export class TileBlockAtlas {
...
@@ -254,7 +255,7 @@ export class TileBlockAtlas {
return
true
;
return
true
;
}
}
add_inner
(
type
,
coords
)
{
add_inner
(
type
,
coords
,
time
)
{
const
blockIndex
=
this
.
getBlockIndex
(
coords
);
const
blockIndex
=
this
.
getBlockIndex
(
coords
);
if
(
!
this
.
tileBlocks
.
has
(
blockIndex
.
y
))
if
(
!
this
.
tileBlocks
.
has
(
blockIndex
.
y
))
...
@@ -272,20 +273,16 @@ export class TileBlockAtlas {
...
@@ -272,20 +273,16 @@ export class TileBlockAtlas {
const
tileBlock
=
subMap
.
get
(
blockIndex
.
x
);
const
tileBlock
=
subMap
.
get
(
blockIndex
.
x
);
tileBlock
.
add
(
type
,
coords
);
tileBlock
.
add
(
type
,
coords
,
time
);
this
.
numTiles
++
;
this
.
numTiles
++
;
}
}
add_one
(
type
,
coords
)
{
this
.
add_inner
(
type
,
coords
);
this
.
history
.
push
([
coords
]);
}
add_many
(
attachments
)
{
add_many
(
attachments
)
{
const
current_time
=
this
.
history
.
length
;
var
all_coords
=
[];
var
all_coords
=
[];
for
(
let
a
of
attachments
)
{
for
(
let
a
of
attachments
)
{
this
.
add_inner
(
a
.
type
,
a
.
coords
);
this
.
add_inner
(
a
.
type
,
a
.
coords
,
current_time
);
all_coords
.
push
(
a
.
coords
);
all_coords
.
push
(
a
.
coords
);
}
}
this
.
history
.
push
(
all_coords
);
this
.
history
.
push
(
all_coords
);
...
...
src/webtas.mjs
View file @
8d01892b
...
@@ -37,8 +37,8 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -37,8 +37,8 @@ document.addEventListener('DOMContentLoaded', () => {
document
.
getElementById
(
'bg-color-input'
).
addEventListener
(
'change'
,
(
e
)
=>
{
simulator
.
setBackgroundColor
(
e
.
target
.
value
);
});
document
.
getElementById
(
'bg-color-input'
).
addEventListener
(
'change'
,
(
e
)
=>
{
simulator
.
setBackgroundColor
(
e
.
target
.
value
);
});
document
.
getElementById
(
'set-background-color-button'
).
addEventListener
(
'click'
,
()
=>
{
document
.
getElementById
(
'bg-color-input'
).
click
();
});
document
.
getElementById
(
'set-background-color-button'
).
addEventListener
(
'click'
,
()
=>
{
document
.
getElementById
(
'bg-color-input'
).
click
();
});
document
.
getElementById
(
'set-temperature-button'
).
addEventListener
(
'click'
,
onSetTemperatureButton
);
document
.
getElementById
(
'set-temperature-button'
).
addEventListener
(
'click'
,
onSetTemperatureButton
);
document
.
getElementById
(
'set-simulation-mode-menu'
).
addEventListener
(
'click'
,
onSetSimulationModeMenu
);
document
.
getElementById
(
'set-simulation-mode-menu'
).
addEventListener
(
'click'
,
onSetSimulationModeMenu
);
document
.
getElementById
(
'report-nondeterminism-checkbox'
).
addEventListener
(
'click'
,
onReportNondeterminism
);
document
.
getElementById
(
'report-nondeterminism-checkbox'
).
addEventListener
(
'click'
,
onReportNondeterminism
);
/* set behavior for rectilinear generator buttons start */
/* set behavior for rectilinear generator buttons start */
...
@@ -173,8 +173,8 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -173,8 +173,8 @@ document.addEventListener('DOMContentLoaded', () => {
function
render
()
{
function
render
()
{
requestAnimationFrame
(
render
);
requestAnimationFrame
(
render
);
const
b_show
=
document
.
getElementById
(
'show-attach-time-checkbox'
).
checked
;
simulator
.
render
();
simulator
.
render
(
b_show
);
}
}
// called when all assets have been loaded
// called when all assets have been loaded
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment