Skip to content

Commit

Permalink
First draft
Browse files Browse the repository at this point in the history
hsjoihs committed Feb 5, 2024
1 parent b063b59 commit 1983d82
Showing 28 changed files with 1,721 additions and 38 deletions.
File renamed without changes
File renamed without changes
131 changes: 131 additions & 0 deletions BAR_ニコ$$0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions BAR_ニコ$$1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 131 additions & 0 deletions BAR_ニコ$$2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
134 changes: 134 additions & 0 deletions FOO_コ$$0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions FOO_コ$$1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
136 changes: 136 additions & 0 deletions FOO_ニココ$$0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions FOO_ニココ$$1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions FOO_ニココ$$2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions FOO_ニココ$$3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions FOO_ニニ$$0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions FOO_ニニ$$1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions FOO_ニニ$$2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 24 additions & 12 deletions all_state_diagrams.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
<!DOCTYPE html><style>img { border: 1px solid pink; } </style><body><p>./FOO$$-1.svg</p><img src="./FOO$$-1.svg" /><hr>
<p>./FOO_NICO$$0.svg</p><img src="./FOO_NICO$$0.svg" /><hr>
<p>./FOO_NICO$$1.svg</p><img src="./FOO_NICO$$1.svg" /><hr>
<p>./FOO_NICO$$2.svg</p><img src="./FOO_NICO$$2.svg" /><hr>
<p>./BAR$$-1.svg</p><img src="./BAR$$-1.svg" /><hr>
<p>./BAR_KO$$0.svg</p><img src="./BAR_KO$$0.svg" /><hr>
<p>./BAR_KO$$1.svg</p><img src="./BAR_KO$$1.svg" /><hr>
<p>./BAR_NINI$$0.svg</p><img src="./BAR_NINI$$0.svg" /><hr>
<p>./BAR_NINI$$1.svg</p><img src="./BAR_NINI$$1.svg" /><hr>
<p>./BAR_NINI$$2.svg</p><img src="./BAR_NINI$$2.svg" /><hr>
<p>./BAR_NICOCO$$0.svg</p><img src="./BAR_NICOCO$$0.svg" /><hr>
<p>./BAR_NICOCO$$1.svg</p><img src="./BAR_NICOCO$$1.svg" /><hr>
<p>./BAR_NICOCO$$2.svg</p><img src="./BAR_NICOCO$$2.svg" /><hr>
<p>./BAR_NICOCO$$3.svg</p><img src="./BAR_NICOCO$$3.svg" /><hr></body>
<p>./FOO_コ$$0.svg</p><img src="./FOO_コ$$0.svg" /><hr>
<p>./FOO_コ$$1.svg</p><img src="./FOO_コ$$1.svg" /><hr>
<p>./FOO_ニコ$$0.svg</p><img src="./FOO_ニコ$$0.svg" /><hr>
<p>./FOO_ニコ$$1.svg</p><img src="./FOO_ニコ$$1.svg" /><hr>
<p>./FOO_ニコ$$2.svg</p><img src="./FOO_ニコ$$2.svg" /><hr>
<p>./FOO_ニニ$$0.svg</p><img src="./FOO_ニニ$$0.svg" /><hr>
<p>./FOO_ニニ$$1.svg</p><img src="./FOO_ニニ$$1.svg" /><hr>
<p>./FOO_ニニ$$2.svg</p><img src="./FOO_ニニ$$2.svg" /><hr>
<p>./FOO_ニココ$$0.svg</p><img src="./FOO_ニココ$$0.svg" /><hr>
<p>./FOO_ニココ$$1.svg</p><img src="./FOO_ニココ$$1.svg" /><hr>
<p>./FOO_ニココ$$2.svg</p><img src="./FOO_ニココ$$2.svg" /><hr>
<p>./FOO_ニココ$$3.svg</p><img src="./FOO_ニココ$$3.svg" /><hr>
<p>./BAR_コ$$0.svg</p><img src="./BAR_コ$$0.svg" /><hr>
<p>./BAR_コ$$1.svg</p><img src="./BAR_コ$$1.svg" /><hr>
<p>./BAR_ニコ$$0.svg</p><img src="./BAR_ニコ$$0.svg" /><hr>
<p>./BAR_ニコ$$1.svg</p><img src="./BAR_ニコ$$1.svg" /><hr>
<p>./BAR_ニコ$$2.svg</p><img src="./BAR_ニコ$$2.svg" /><hr>
<p>./BAR_ニニ$$0.svg</p><img src="./BAR_ニニ$$0.svg" /><hr>
<p>./BAR_ニニ$$1.svg</p><img src="./BAR_ニニ$$1.svg" /><hr>
<p>./BAR_ニニ$$2.svg</p><img src="./BAR_ニニ$$2.svg" /><hr>
<p>./BAR_ニココ$$0.svg</p><img src="./BAR_ニココ$$0.svg" /><hr>
<p>./BAR_ニココ$$1.svg</p><img src="./BAR_ニココ$$1.svg" /><hr>
<p>./BAR_ニココ$$2.svg</p><img src="./BAR_ニココ$$2.svg" /><hr>
<p>./BAR_ニココ$$3.svg</p><img src="./BAR_ニココ$$3.svg" /><hr></body>
45 changes: 45 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<meta charset="utf-8">

<html lang="ja">

<script>
function foo() {
const automaton = document.getElementById("automaton").value;
const input_string = document.getElementById("input_string").value;
let step = document.getElementById("step").value;

document.getElementById("step").max = input_string.length;

if (Number(step) > input_string.length) {
step = `${input_string.length}`;
}

// console.log({ automaton, input_string, step });

const path = `${automaton}_${input_string}$$${step}.svg`;
document.getElementById("result").innerHTML = `<img src="${path}">`
}
</script>


<label for="automaton">使うオートマトン: </label><select id="automaton" onchange="foo()">
<option value="FOO">FOO</option>
<option value="BAR">BAR</option>
</select><br>

<label for="input_string">入力文字列: </label><select id="input_string" onchange="foo()">
<option value=""></option>
<option value="ニコ">ニコ</option>
<option value="ニニ">ニニ</option>
<option value="ニココ">ニココ</option>
</select><br>

<label for="step">ステップ数: </label>
<input type="range" id="step" name="step" min="0" max="3" onchange="foo()" />
<div id="result">

</div>


</html>
28 changes: 19 additions & 9 deletions state-diagrams.js
Original file line number Diff line number Diff line change
@@ -62,12 +62,14 @@ writeGraph2({ 回: 2, セクション: 5, ファイル名: "FOO$$-1.svg" }, {
width: 418.5,
height: 209.43
}, FOO);
playback_automaton_and_write_sequential({
: 2, セクション: 5, file_prefix: "FOO_NICO$$",
}, {
width: 418.5,
height: 209.43
}, FOO, "ニコ");
function foo(s) {
playback_automaton_and_write_sequential({
: 2, セクション: 5, file_prefix: `FOO_${s}$$`,
}, {
width: 418.5,
height: 209.43
}, FOO, s);
}
const BAR = {
vertices: [
{ id: "q1", center: { x: 0, y: Math.sqrt(3) / 2 } },
@@ -101,7 +103,15 @@ function playback_automaton_and_write_sequential(p, o, g, input) {
});
}
}
playback_automaton_and_write_sequential({ : 2, セクション: 5, file_prefix: `BAR_KO$$`, }, { width: 418.5, height: 300 }, BAR, "コ");
playback_automaton_and_write_sequential({ : 2, セクション: 5, file_prefix: `BAR_NINI$$`, }, { width: 418.5, height: 300 }, BAR, "ニニ");
playback_automaton_and_write_sequential({ : 2, セクション: 5, file_prefix: `BAR_NICOCO$$`, }, { width: 418.5, height: 300 }, BAR, "ニココ");
function bar(s) {
playback_automaton_and_write_sequential({ : 2, セクション: 5, file_prefix: `BAR_${s}$$`, }, { width: 418.5, height: 300 }, BAR, s);
}
foo("コ");
foo("ニコ");
foo("ニニ");
foo("ニココ");
bar("コ");
bar("ニコ");
bar("ニニ");
bar("ニココ");
fs.promises.writeFile("all_state_diagrams.html", `<!DOCTYPE html><style>img { border: 1px solid pink; } </style><body>${final_image_list.map(path => `<p>${path}</p><img src="${path.replace('#', '%23')}" /><hr>`).join("\n")}</body>`);
37 changes: 20 additions & 17 deletions state-diagrams.ts
Original file line number Diff line number Diff line change
@@ -52,13 +52,16 @@ writeGraph2(
height: 209.43
}, FOO);

function foo(s: string){
playback_automaton_and_write_sequential(
{
: 2, セクション: 5, file_prefix: "FOO_NICO$$",
: 2, セクション: 5, file_prefix: `FOO_${s}$$`,
}, {
width: 418.5,
height: 209.43
}, FOO, "ニコ");
}, FOO, s);
}


const BAR: AutomatonGraph = {
vertices: [
@@ -105,23 +108,23 @@ function playback_automaton_and_write_sequential(
}
}

playback_automaton_and_write_sequential(
{ : 2, セクション: 5, file_prefix: `BAR_KO$$`, },
{ width: 418.5, height: 300 },
BAR, "コ"
);
function bar(s: string) {
playback_automaton_and_write_sequential(
{ : 2, セクション: 5, file_prefix: `BAR_${s}$$`, },
{ width: 418.5, height: 300 },
BAR, s
);
}

playback_automaton_and_write_sequential(
{ : 2, セクション: 5, file_prefix: `BAR_NINI$$`, },
{ width: 418.5, height: 300 },
BAR, "ニニ"
);

playback_automaton_and_write_sequential(
{ : 2, セクション: 5, file_prefix: `BAR_NICOCO$$`, },
{ width: 418.5, height: 300 },
BAR, "ニココ"
);
foo("コ");
foo("ニコ");
foo("ニニ");
foo("ニココ");

bar("コ");
bar("ニコ");
bar("ニニ");
bar("ニココ");

fs.promises.writeFile("all_state_diagrams.html", `<!DOCTYPE html><style>img { border: 1px solid pink; } </style><body>${final_image_list.map(path => `<p>${path}</p><img src="${path.replace('#', '%23')}" /><hr>`).join("\n")}</body>`);

0 comments on commit 1983d82

Please sign in to comment.