Skip to content

Commit

Permalink
update petri
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Jan 14, 2024
1 parent eb9a3c6 commit c605285
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions resen/down/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
html {
overscroll-behavior: none;
}

body {
background-image: url('down.jpg');
background-position: 43% 40%;
Expand Down
2 changes: 1 addition & 1 deletion resen/petri/petri.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"זעם עזה": 1
},

"labels": {"רבייה_ישראל": "BREEDING_ISRAEL", "צבא": "MILITARY", "בית עלמין עזה": "GAZA CEMETERY", "מבצע": "OPERATION", "זעם עזה": "GAZA WRATH", "ישראל": "ISRAEL", "שחרור": "DISCHARGE", "פטירה_עזה": "PASSING_GAZA", "עזה": "GAZA", "הסתה": "INCITEMENT", "זעם ישראל": "ISRAEL WRATH", "חטיפה": "ABDUCTION", "שבי": "CAPTIVITY", "רבייה_עזה": "BREEDING_GAZA", "בית עלמין ישראל": "ISRAEL CEMETERY", "פיגוע": "TERROR ATTACK", "ארגון טרור": "TERROR GROUP", "חילוף": "EXCHANGE", "כלא": "PRISON", "פטירה_ישראל": "PASSING_ISRAEL"},
"labels": {"רבייה_ישראל": "BREEDING_ISRAEL", "צבא": "MILITARY", "מבצע": "OPERATION", "עזה": "GAZA", "רבייה_עזה": "BREEDING_GAZA", "ישראל": "ISRAEL", "שחרור": "DISCHARGE", "בית עלמין עזה": "GAZA CEMETERY", "פטירה_עזה": "PASSING_GAZA", "כלא": "PRISON", "הסתה": "INCITEMENT", "פטירה_ישראל": "PASSING_ISRAEL", "בית עלמין ישראל": "ISRAEL CEMETERY", "שבי": "CAPTIVITY", "חילוף": "EXCHANGE", "זעם עזה": "GAZA WRATH", "פיגוע": "TERROR ATTACK", "זעם ישראל": "ISRAEL WRATH", "חטיפה": "ABDUCTION", "ארגון טרור": "TERROR GROUP"},

"require": [
["ישראל", "צבא"],
Expand Down
11 changes: 6 additions & 5 deletions resen/petri/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const label_location = '' // Can be: 'half' (half above and half below, favorin
const default_token_symbol = 'o' // Cannot be of 1-9 or capital A-N
const arrow_width = 6
const arrow_height = 1
const arrow_diagonal = 4
const arrow_diagonal = 3
const diagonal_offset = 19
const comp_marking = 5

Expand Down Expand Up @@ -158,7 +158,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
const width = max_len(transitions.filter(t => !is_vertical(grid, t)), json.labels)
const height = max_len(transitions.filter(t => is_vertical(grid, t)), json.labels, true)

const other_arrows = []
const missing_arrows = []
const elems = grid.querySelectorAll('pre')
let cols = grid_columns
if (comp)
Expand Down Expand Up @@ -206,7 +206,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
else if (elem.parentElement.children[index + cols] == pelem)
elem.parentElement.children[index + cols].dataset.before = arrows(out, inp, 1)
else
other_arrows.push([elem, pelem, inp, out])
missing_arrows.push([elem, pelem, inp, out])
} else if (!comp)
if (elem.previousSibling == pelem && index % cols)
elem.previousSibling.firstChild.dataset.after = arrows(inp, out, '')
Expand All @@ -217,7 +217,7 @@ function step(grid, json, steps=0, max_tokens={}, result_counter={}, reset_count
else if (elem.parentElement.children[index + cols] == pelem)
elem.dataset.after = arrows(out, inp)
else
other_arrows.push([elem, pelem, inp, out])
missing_arrows.push([elem, pelem, inp, out])
})
if (ts || te || bs || be)
elem.firstChild.dataset.before = diagonal_arrows(ts, te, bs, be)
Expand Down Expand Up @@ -292,7 +292,8 @@ fetch(json_file).then(response => response.json()).then(json => {
bottom_arrows |= bottom_arrow
const is_ver = top_arrow || bottom_arrow
ver += is_ver
if (!is_hor && !is_ver) {
is_diag = (labels[index - cols - 1] == place || labels[index + cols - 1] == place) && index % cols || (labels[index - cols + 1] == place || labels[index + cols + 1] == place) && (index+1) % cols
if (!is_hor && !is_ver && !is_diag) {
place_index = labels.indexOf(place)
long += place_index % cols == 0 || (place_index+1) % cols == 0 || place_index / cols | 0 == 0 || place_index / cols | 0 == rows - 1
}
Expand Down

0 comments on commit c605285

Please sign in to comment.