2024,江端さんの忘備録

震災になると、物資が来ないだけでなく、水もガスも来なくなります。

When the earthquake strikes, not only will supplies not come, but also water and gas will not come.

せめて情報だけでも入手したいと思っても、電気が来ないので、テレビは使えません。インターネットは言うまでもありません。

Even if you want to get some information, you cannot use the TV because there is no electricity. Not to mention the Internet. Smartphones are just a matter of time.

私は、一応、手回し発電機を入手しています。

I am getting a hand-cranked generator.

残った情報取得手段は、ラジオくらいですが、数年前に購入したラジオは、多分、電池から液漏れを起こしていて、動かなくなっています(あれは、定期的にスイッチを入れないと、ダメなものなのです)。

The only remaining means of obtaining information is a radio. Still, the radio I bought a few years ago has probably stopped working because the batteries are leaking (that thing is no good unless you turn it on regularly).

しかし、電源不要で、半永久に動き続けるラジオというものがあります。

However, some radios do not require a power source and work semi-permanently.

「ゲルマニウムラジオ」です。

"Germanium Radio."

受信アンテナからのラジオ波をゲルマニウムダイオード(整流器)を使用して検波し、それによって音声信号を取り出します。つまり、電源供給が不要で、単にアンテナとスピーカー(またはヘッドフォン)を接続するだけで動作します。

Radio waves from the receiving antenna are detected using a germanium diode (rectifier), extracting the audio signal. This means no power supply is required; simply connecting the antenna and speakers (or headphones) is all that is needed to operate.

基本的には検波が簡単なAM放送に使われますが、災害情報は、現時点ではNHKラジオ放送だけが頼りです。

It is used for AM broadcasts, which are easier to detect, but NHK radio broadcasts are the only reliable source for disaster information.

(ちょっと驚いたのですが、無電源のFMラジオを試している方がいらっしゃるようです)

(I was surprised that some people are trying out the powerless FM radio.)

私がNHK受信料を支払っている理由の一つには、この「災害情報インフラへの継続的投資」があります。

One of the reasons I pay NHK subscription fees is this "ongoing investment in disaster information infrastructure."

個人的な見解ですが、我が家のNHK受信料の支払いは、ある種の保険料であって、災害大国日本では、十分に『元が取れている』と思っています。

In my opinion, the NHK subscription fee paid by my family is a kind of insurance premium, and in Japan, a disaster-prone country, I believe it is well "paid for."

-----

ゲルマニウムラジオを製品化して販売した売れるんじゃないかな、と思っているのですが、見つけられていません。

I think a Germanium radio could be commercialized and sold, but I have not found one.

(子どもの科学向けのキットがありますが、ちゃんとパッケージ化された製品は見つかりません)。

(There are kits for children's science, but I can't find an adequately packaged product.)

まあ、あまり利益が出せそうにはないのですが。

Well, it is not going to be very profitable.

私なら、そのラジオを、天井の火災報知器の横に貼りつけておきます。

I would stick that radio following the fire alarm in the ceiling.

-----

そういう訳で、私、NHKラジオ第1・第2の統合は良いと思っているのですが、FM局への全転換は、よくよく考えた方が良いと思っています。

Integrating NHK Radio 1 and 2 is a good idea, but the total conversion to an FM station should be well thought out.

もう一度、あの日の恐怖を思い出してみましょう。

 

 

未分類

先日国会で成立した、国土強靭化基本法を熟読しています。

I read letters of the law named "Basic Law of National Land Enhancement."

一見無味乾燥な法令に見えますが、これは読み方によっては、とても面白いです。

At first glance, it looks like monotony law, but it is exciting from another perspective.

「省庁の縦割りを解消し」などという識者もいるようですが、私は、まったく逆に「縦割りを明文化した」というくらいに読めました(第11条~21条)。

Though some analysts tell us that this law results in compartmentalized public administration, I think it is the opposite; the law defines it.

私は、シミュレーション結果で、100年後に現在の人口の20%にまで落ち込むと予想しているので、人口を大都市に集中して社会インフラを集結することを考えていました。

I estimate that the population in Japan has decreased by 20% from the present after 100 years ago. I am afraid we must migrate to urban areas and integrate social infrastructures.

つまり、「地域を切り捨てる」しか日本が生き残る道はない、と思っていたのですが、この法律では、完全にその逆を唱えています(第2条:多極分散型の国土の形成)。

I mean, "Discarding rural areas." I think it is a final decision to survive in this country. But this law says the opposition against my opinion(Article 2: multiple cities)

といいつつ、その分散を3つに定義しています。具体的には、(1)首都圏、(2)近畿圏、(3)中部圏です(第8条)。

On the other hand, the law also defines the three decentralized areas: "Tokyo Metropolitan District," "Osaka Metropolitan District," and "Chuubu Metropolitan District"(Article 8).

―― という話を、後輩にしたところ、

I told the above issue to a junior fellow,

後輩:「江端さん。そりゃ分散のアプローチが間違っていませんか? 南海トラフで、その3つの分散は、纏めて全滅ですよ」

Ebata-san, I think there seems to be a wrong approach. The big earthquake in the Pacific zone will hit the three areas at the same time.

江端:「ま、一気に撃たれることはない、という見込みなのだろうと思う。でも、災害を想定した本当に分散する気があるなら、札幌圏、首都圏、高松圏、福岡圏の4つかなぁ」

Probably, I think they estimate not to do it simultaneously. If I were an administration, I would define four areas, "Sapporo," "Tokyo," "Takamatsu," and "Fukuoka."

まあ、「地域を捨てる」などという方針が出たとすれば、法案が潰されるのは当然として、政権与党の存続だって危ういだろうな、とは思うのです。

If "discarding rural areas" were included in the law, the Diet refused the bill and upset the regime.

それに、まだ「地域を切り捨てる」という決断をするには早いかもしれません。少子化の問題だって、何かの奇跡が起きて、持ち直すかもしれないじゃないですか ―― その奇跡に、全く心辺りがないとしても、です。

And it seems to be too early to judge it. The problem of a society with fewer children might be resolved in some miracle works -- I don't know them at all.

-----

なぜ、このような法律を調べているかというと、災害時を想定したシステムの提案資料を作る為です。

I investigated the law to make a proposal material for the system against some kinksters in Japan maJapan'sd.

で、その他の資料も色々見付けているのですが、これはいいですよ。是非御一読を。

I strongly encourage you to read the following paper.

その辺の小説より、ドキドキできます。

You must be excited, more than crisis novels around you.

-----

特に、地震直後に、停電→テレビ・ラジオ・PC全滅→情報ゼロ という状況は、リアルです。

Significantly, the story of a blackout, inactivate of TV, radio, and PC, and no information is authentic.

震災の時も、電池式のラジオだけが、最後の砦でした。

The cell radio is the last straw on the day of the earthquake disaster.

これも何かの機会です。もう一度、あの日の恐怖を思い出してみましょう。

This is a good change. Let us try to remember the fear of the day.

2023,江端さんの技術メモ

以下のtest.csvファイルを、gunplotで3D表示させたくて、色々やっています。

test.csv
#lat,lng,datetime,distance,speed
35.681100,139.758600,2023-05-22 02:10:30,313.307785,37.596934
35.683300,139.759900,2023-05-22 02:11:00,271.347933,32.561752
35.685300,139.760900,2023-05-22 02:11:30,240.030143,28.803617
35.685400,139.761000,2023-05-22 02:12:00,14.325264,1.719032
35.685400,139.761000,2023-05-22 02:12:30,0.000000,0.000000
35.685400,139.761100,2023-05-22 02:13:00,9.031610,1.083793
35.685200,139.763500,2023-05-22 02:13:30,217.896760,26.147611
35.684700,139.765700,2023-05-22 02:14:00,206.328362,24.759403
35.684200,139.768000,2023-05-22 02:14:30,215.040983,25.804918
35.685400,139.768400,2023-05-22 02:15:00,138.238013,16.588562

で、まあ、こんなgpファイルを使って試していましたが、上手く動きませんでした。

# Function to parse datetime string into a numerical value
strptime_datetime(x) = strptime('%Y-%m-%d %H:%M:%S', x)

# Set the output terminal to a 3D plot (you can change the output format if needed)
set terminal pngcairo enhanced size 800,600

# Set the data file separator to a comma
set datafile separator ','

# Set the axis labels
set xlabel 'Longitude (lng)'
set ylabel 'Latitude (lat)'
set zlabel 'Date and Time (datetime)'

# Set the view to a 3D perspective
set view 50,30,1,1


# Get the minimum and maximum datetime values from the data
stats 'test.csv' using (strptime_datetime(stringcolumn(3))) nooutput
min_datetime = STATS_min
max_datetime = STATS_max

# Set the range for the Z axis (datetime)
set zrange [min_datetime:max_datetime]

# Plot the data using the specified columns
#splot 'test.csv' using 2:1:(timecolumn(stringcolumn(3))) with points pointtype 7 pointsize 1 title 'Data Points'
#splot 'test.csv' using 2:1:(timecolumn(stringcolumn(3))) with points pointtype 7 pointsize 1 title 'Data Points'
#splot 'test.csv' using 2:1:(timecolumn(stringcolumn(3))):(0) with points pointtype 7 pointsize 1 title 'Data Points'

splot 'test.csv' using 2:1:(timecolumn(stringcolumn(3)))

時間のパース(strptime_datetime(x) = strptime('%Y-%m-%d %H:%M:%S', x))がやっぱり上手く動きませんでした。

でまあ、しょうがないので、"2023-05-22 02:10:30"を秒数に変換するプログラムを作成しました。

/* "2023-05-22 02:10:30"を秒数に変換するプログラムを作成しました
   c:\Users\ebata\gnuplot\convert_datetime.go
*/
package main

import (
	"encoding/csv"
	"fmt"
	"os"
	"time"
)

func main() {
	// 入力ファイル名と出力ファイル名を指定
	inputFileName := "test.csv"
	outputFileName := "formatted_test.csv"

	// 入力ファイルを開く
	inputFile, err := os.Open(inputFileName)
	if err != nil {
		fmt.Println("ファイルを開けませんでした:", err)
		return
	}
	defer inputFile.Close()

	// 出力ファイルを作成または上書き
	outputFile, err := os.Create(outputFileName)
	if err != nil {
		fmt.Println("ファイルを作成できませんでした:", err)
		return
	}
	defer outputFile.Close()

	// CSVリーダーとライターを作成
	reader := csv.NewReader(inputFile)
	writer := csv.NewWriter(outputFile)

	// ヘッダーを読み込み、書き込み
	header, err := reader.Read()
	if err != nil {
		fmt.Println("ヘッダーを読み込めませんでした:", err)
		return
	}
	writer.Write(header)

	// データを読み込んで秒数に変換して書き込み
	for {
		record, err := reader.Read()
		if err != nil {
			break
		}

		// datetime列をパースして秒数に変換
		datetime := record[2] // datetime列のインデックスを確認してください
		parsedTime, err := time.Parse("2006-01-02 15:04:05", datetime)
		if err != nil {
			fmt.Println("日時をパースできませんでした:", err)
			return
		}
		seconds := parsedTime.Unix()

		// 秒数に変換した値を新しい列として書き込み
		record = append(record, fmt.Sprintf("%d", seconds))
		writer.Write(record)
	}

	// ライターをフラッシュしてクローズ
	writer.Flush()

	if err := writer.Error(); err != nil {
		fmt.Println("書き込みエラー:", err)
		return
	}

	fmt.Println("変換が完了しました。出力ファイル:", outputFileName)
}

で、こんなのができました。
formatted_test.csv

#lat,lng,datetime,distance,speed
35.681100,139.758600,2023-05-22 02:10:30,313.307785,37.596934,1684721430
35.683300,139.759900,2023-05-22 02:11:00,271.347933,32.561752,1684721460
35.685300,139.760900,2023-05-22 02:11:30,240.030143,28.803617,1684721490
35.685400,139.761000,2023-05-22 02:12:00,14.325264,1.719032,1684721520
35.685400,139.761000,2023-05-22 02:12:30,0.000000,0.000000,1684721550
35.685400,139.761100,2023-05-22 02:13:00,9.031610,1.083793,1684721580
35.685200,139.763500,2023-05-22 02:13:30,217.896760,26.147611,1684721610
35.684700,139.765700,2023-05-22 02:14:00,206.328362,24.759403,1684721640

スクリプトではなく、コマンドで一つづつ入れていきました。

gnuplot> set datafile separator ','   ← これ凄く重要
gnuplot> splot "formatted_test.csv" using 2:1:6
の結果は以下の通りでした。

エリア限定
# x軸の範囲を指定
set xrange [139.6119000:139.6312000]

# y軸の範囲を指定
set yrange [35.3627000:35.3737000] ←これだと、地図のイメージと逆転するので
set yrange [35.3737000:35.3627000]  ← y軸の範囲を逆転させる

上記のxrangeとyrangeの範囲を地図で示すと、

の範囲となる。
領域の範囲内でのトラッキングデータの様子

gnuplotでx軸とy軸の範囲を指定解除するには、以下のコマンドを使用する。

gnuplot> set xrange [*:*]
gnuplot> set yrange [*:*]

gnuplot> splot "2023-topLatLngCounts4-1.csv" using 2:1:3
gnuplot> set yrange [35.3737000:35.3627000]    ← 軸の大小を引っくり返す
gnuplot> splot "2023-topLatLngCounts4-1.csv" using 2:1:3 ← 点を表示
gnuplot> replot "2023-topLatLngCounts4-1.csv" using 2:1:3 with impulses ← 縦軸表示

ちなみに、文字列が入っているcsvだと表示されないことが多いようだ。

2024,江端さんの忘備録

先日嫁さんと話していたのですが、私は世間の人とは若干価値観が違うところがあるようです。

I was talking to my wife the other day, and it seems I have slightly different values than the rest of the world.

(1)自分より背の高い女性とか低い女性とか、そういうことを考えたことがない

(1) I've never considered women taller or shorter than me.

以前から申し上げている通り、私の恋愛対象の第一印象の価値基準は「自分の好みの顔」です。

As I have said before, my value criterion for first impressions in a relationship is "the face I like."

但し、世間の多数によって認定されている"美人"というものとは違うようです。

However, it seems this is not the same as the "beauty" most public recognizes.

女性:「では、先ず、ダイエットをしましょうか」

(2)事故物件(自殺者や殺人事件があった借家等)は、採否の判断基準にならない

(2)Accidental properties (e.g., houses that have had suicides or murders) are not a criterion for acceptance or rejection.

私は、いわゆる、霊魂やお化けの存在を否定していません。むしろ、個人的には『存在していて欲しい』と思っている方です。

I do not deny the existence of so-called spirits or ghosts. Instead, I am one who 'wants them to exist.

自分の五感で確認したいし、可能なら「場」の観測をさせて欲しいと思っています。かなり真剣に。

I want to confirm them with my senses, and if possible, I would like to be allowed to observe the "place." Quite seriously.

ただ、エネルギー保存法則的には、質量を有しないモノが、現実世界に与える影響は非常に小さいと思うので、日常生活に支障を与えることは、かなり難しいだろう、と考えているだけです。

From the point of view of the law of conservation of energy, I think it would be pretty difficult for things without mass to interfere with our daily lives because their impact on the real world would be minimal.

そもそも、「見えなくても存在するもの」は、世の中に腐るほどあります。重力場、電磁場などです。

To begin with, there are plenty of "things that exist even if you can't see them" in the world. These include gravitational fields, electromagnetic fields, etc.

ぶっちゃけ、私は、霊魂やお化けより、量子力学の方が怖いです(本当)。

I am more afraid of quantum mechanics than I am of spirits and ghosts (really).

逆に、事故物件は、安く借りられるそうなので、これは私には福音です。

On the other hand, I hear that accidental properties can be rented at a discount, which is gospel to me.

(3)インテリア、エクステリアへの興味が希薄

(3) Lack of interest in interior and exterior design

私は、徹底した機能主義者なので、美醜や意匠(デザイン)に、あまり興味がありません。

I am a thorough functionalist, so I am not interested in beauty, ugliness, or design.

静かに高速にスマートに走る高級車なんぞに、1mmも価値を感じられません。

I don't feel a millimeter of value in a luxury car that runs quietly, fast, and smartly.

エンジンが設置された位置から、異音や異常な振動を感じられるような、古くて、壊れかけた車の方が好きです。

I prefer older, broken-down cars where I can hear unusual noises and feel abnormal vibrations from where the engine is installed.

自動車の構造を体感できるからです。

This is because I can experience the structure of an automobile.

ただ、マーケットにおいて、「機能」が「意匠(デザイン)」に負けることは、思い知っています。

However, I know that "function" loses out to "design" in the marketplace.

視覚に訴える媒体(ここでは「デザイン」という)のパワーは恐るべきものがあります。

-----

なんとなく思い出したので、書き出してみました。

I remembered it, so I wrote them down.

2015,江端さんの忘備録

(昨日の続きです)

(Continuation from yesterday)

視覚に訴える媒体(ここでは「デザイン」という)のパワーは恐るべきものがあります。

I believe the media based on visualization, calling it "design" in this diary, is awful.

■まず、第一に、デザインが圧倒的に購買意欲を支えているという事実があります。

Firstly, "design" appeals to "eagerness to buy" strongly.

私がどんなに機能が優れていることを説明しても、嫁さんや娘達は、自分の気に入ったデザインの自動車や携帯電話から、ブレることはありませんでした。

My wife and daughters had never accepted my persuasion that they should select productions, like automobiles and cell phones, to view the functions.

私はこの時、私たちエンジニアが命懸けで開発している「機能」という価値が、「デザイン」という価値には、遠く及ばないことを、魂のレベルで理解したのです。

At that time, I could understand profoundly that the value of "functions" is inferior to the value of "design," even if our engineers struggle to develop new good functions.

私は、MACやiPod/iPADのデザインやインターフェースが好きではありませんが、私が少数派であることは、明らかなことです。

I wouldn't say I like the designs and the interface of MAC or iPod/iPad, though it is obvious that I am in a minority group.

■第二に、デザインは、世界共通言語であるという事実があります。

Secondly, "design" is an international communication language.

「英語に愛されないエンジニア」であるこの私でさえ、海外赴任や出張をしてこれたのは、世界中にホワイトボードがあり、そして、メモ用紙があったからです。

I have gone on business trips worldwide, though I am a typical "loveless engineer from English" because I can use paper and whiteboard.

"□"と"→"さえ書ければ、「この世界の全ての事象は表現できる」と思っています。

I can explain "the world" by drawing rectangles and arrows.

■第三に、(これはエンジニア特有の話になりますが)デザインが、工学的アプローチに必須のアイテムであるという事実があります。

Thirdly (this might be for engineers only), "design" is indispensable for the engineering approach.

絵が含まれていないプレゼンテーション資料なんぞ、誰にも読んで貰えません。

Nobody wants to read a presentation material with pictures.

また、図面を含まない特許明細書は、多くの場合、特許庁の審査官から拒絶査定を喰らいます。

In many cases, patent applications without a picture are rejected by the Patent Office Board of Appeals.

それは、「発明が劣っている」からではなく「審査官が発明を理解するのが難しくなる」からです。

It is not for "poor invention" but for "hard to be understood by examiners."

それと、自分のアイデアを、デザインレベルで具現化できる、ということは、そのアイデアが「完成している」ということの証明になります。

Moreover, the "possibility to realize my idea as a design" proves my idea's completion.

-----

ところが、この「デザインを舐めている」エンジニアや研究者が、結構な数いるんですよ。

However, I am afraid that many engineers and researchers make little of this design power.

(続く)

(To be continued)

2024,江端さんの忘備録

今回の地震の第1報で、私の中に最初に出てきた記憶が「スキップとローファー」でした。

The first memory that came to my mind at the first report of this earthquake was "Skips and Loafers."

今回の被災地には、私の親戚も思い当たる友人もいないのですが、それと同等、あるいはそれ以上に、コミックの登場人物を現在被災している方々に重ねて、思いを馳せる ――

I have no relatives or friends in the disaster area; however, I come to overlap the characters in the comic and the people who are currently suffering from the disaster.

これは、不謹慎なことではないと、私は思う(そう信じる)。

This is not inappropriate, I think (and believe).

『自分が何をしなければならないか、ようやく気がついた時、それは、非常に小さくて基本的なものであった』

2024,江端さんの忘備録

世界的に有名なアルゴリズムの改良版を考えていました。

Last night, I contemplated an improved version of the world-famous algorithm, which I believe is the most popular and effective.

しかし、先行研究を調べても、私の考えと同じん内容の論文が出てこなくて、不思議に思っていました。

However, I wondered why I could not find any papers describing the same ideas as mine when I checked the previous studies.

―― もしかして、私が世界初?

"Perhaps I am the first in the world?"

もしそうなら、『これで、1本(の論文)稼げた!』てなことを考えていました。

If so, "Now I've earned one (thesis)!" I thought to myself.

-----

まいったなぁ。

Oh, man.

これから、『江端法』なんて名前が付くアルゴリズムが世界で使われるようになるのかなぁ。

I wonder if algorithms with names like the "Ebata Method" will be used.

自己紹介の時に、「あの『江端法』の江端です」なんて、言わなくちゃならないのかなぁ。

I wonder if I have to say, "I am Ebata of that 'Ebata Method'" when I introduce myself.

偉そうに聞こえないように、言い方をちょっと工夫しなければ。

I have to be a little creative in how I say it so that I don't sound like a pompous ass.

などと考えながら、コーディングをしていたのですが、

I was coding, thinking about things such as the above.

『あれ? コスト値が状態に対して変動的であったとしても、従来法がそのまま適用できるんじゃないか?』

'Huh? Even if cost values were variable for the state, wouldn't the conventional method still apply?'

と気がついたのは、朝の5時でした。

I realized that it was 5:00 in the morning.

-----

1時間を稼ぐのに、ゼーゼー言っている最中に、この「頭脳をフル回転させながら、失なった無意味な数時間」は ――

While heaving to earn an hour, these "meaningless hours lost while racking your brains at full speed"--

死ぬほど痛い。

Hurts to death for me.

 

時間のない中での、こういう一日は ―― 本当に痛い。

 

2024,江端さんの技術メモ

運行情報(ダイヤグラム)を反映した最短時間で到着する計算方法は、通常のダイクストラ法を拡張して実行することができます。以下は、ダイヤ情報を考慮する最短到着時間を計算する一般的なアプローチです:

  1. グラフの作成:
    • ダイヤグラムに基づいて、駅間の接続を表すグラフを作成します。各エッジ(駅間の接続)には、所要時間が含まれます。
    • グラフのノードは駅を表し、エッジの重みは駅間の移動にかかる時間です。
    • 通常のダイクストラ法と同様に、出発駅を始点としてグラフを探索します。
  2. ノードの拡張と更新:
    • 通常のダイクストラ法と同様に、出発駅から各駅への最短到着時間を記録するデータ構造を使用します。初期状態では、出発駅の最短到着時間を0に設定し、他の駅は無限大(無効値)とします。
    • プライオリティキューを使用して、最短到着時間が最小の駅を選択します。
  3. ダイヤ情報の適用:
    • 選択した駅から出発するエッジを調べ、ダイヤ情報を考慮して最短到着時間を計算します。
    • ダイヤ情報には、駅への到着時間や運行間隔などが含まれます。現在の到着時間とダイヤ情報を使用して、次の駅への最短到着時間を計算します。
    • 新しい到着時間が現在の最短到着時間よりも短い場合、その駅の最短到着時間を更新します。
  4. プライオリティキューから次の最短到着時間の駅を選択し、ステップ3を繰り返します。目的の駅に到達した場合、計算を終了します。
  5. 最短到着時間を使用して、目的の駅への最短経路を復元します。

このアプローチを使用すると、ダイヤ情報を反映した最短到着時間を計算できます。ダイヤ情報は、駅への到着時間や運行間隔を正確に取得し、計算に組み込む必要があります。また、プライオリティキューの実装や適切なデータ構造の設計も重要です。

2024,江端さんの技術メモ

/* 
   簡易バスダイヤ作成プログラム    c:\users\ebata\dummy1.go

   (1)バス路線があり、5つの停留所("A0", "A1", "A2", "A3", "A4", "A5")があります。
   (2)このバスは始点から運行を開始し、路線の終点でで一定時間停車した後、再び逆方向に運行を開始します。
   (3)バスは朝6時に出発して、5分単位で次の停留所で停止し、終端で10分間停止します。
   (4)これを3往復するものとします。

*/



package main

import (
	"fmt"
	"strings" // strings パッケージをインポート
	"time"
)

// バスのダイヤグラム
type BusSchedule struct {
	Route             []string             // 停留所のリスト
	DepartureTime     time.Time            // 出発時刻
	ArrivalTimeStops  map[string][]string // 各停留所の到着時刻
	ArrivalTimeRounds int                  // 往復回数
}

// バスのダイヤグラムを生成する関数
func GenerateBusSchedule(route []string, departureTime time.Time, numRoundTrips int) *BusSchedule {
	schedule := &BusSchedule{
		Route:             route,
		DepartureTime:     departureTime,
		ArrivalTimeStops:  make(map[string][]string),
		ArrivalTimeRounds: numRoundTrips,
	}

	currentTime := departureTime
	reverse := false // 逆向き運行を切り替えるフラグ

	for round := 0; round < numRoundTrips; round++ {
		routeOrder := make([]string, 0, len(route)*2-1)

		if reverse {
			// 逆向き運行の場合、終点から始点に戻る
			for i := len(route) - 1; i >= 0; i-- {
				stop := route[i]
				arrivalTime := currentTime.Format("15:04")
				schedule.ArrivalTimeStops[stop] = append(schedule.ArrivalTimeStops[stop], arrivalTime)
				routeOrder = append(routeOrder, fmt.Sprintf("%s(%d): %s", stop, len(schedule.ArrivalTimeStops[stop]), arrivalTime))
				if i > 0 {
					currentTime = currentTime.Add(5 * time.Minute)
				}
			}
			reverse = false
		} else {
			// 正向き運行の場合、始点から終点に向かう
			for i := 0; i < len(route); i++ {
				stop := route[i]
				arrivalTime := currentTime.Format("15:04")
				schedule.ArrivalTimeStops[stop] = append(schedule.ArrivalTimeStops[stop], arrivalTime)
				routeOrder = append(routeOrder, fmt.Sprintf("%s(%d): %s", stop, len(schedule.ArrivalTimeStops[stop]), arrivalTime))
				if i < len(route)-1 {
					currentTime = currentTime.Add(5 * time.Minute)
				}
			}
			reverse = true
		}

		fmt.Println(strings.Join(routeOrder, "->"))
		currentTime = currentTime.Add(10 * time.Minute) // 終点での停止時間
	}

	return schedule
}

func main() {
	route := []string{"A0", "A1", "A2", "A3", "A4", "A5"}
	departureTime := time.Date(2024, 1, 6, 6, 0, 0, 0, time.UTC)
	numRoundTrips := 3

	schedule := GenerateBusSchedule(route, departureTime, numRoundTrips)

	// routeOrder を表示
	fmt.Println("routeOrder:")
	for _, stop := range schedule.Route {
		fmt.Printf("%s:\n", stop)
		for i, arrivalTime := range schedule.ArrivalTimeStops[stop] {
			fmt.Printf("  通過%d: %s\n", i+1, arrivalTime)
		}
	}
}

出力結果

C:\Users\ebata>go run dummy1.go
A0(1): 06:00->A1(1): 06:05->A2(1): 06:10->A3(1): 06:15->A4(1): 06:20->A5(1): 06:25
A5(2): 06:35->A4(2): 06:40->A3(2): 06:45->A2(2): 06:50->A1(2): 06:55->A0(2): 07:00
A0(3): 07:10->A1(3): 07:15->A2(3): 07:20->A3(3): 07:25->A4(3): 07:30->A5(3): 07:35
routeOrder:
A0:
通過1: 06:00
通過2: 07:00
通過3: 07:10
A1:
通過1: 06:05
通過2: 06:55
通過3: 07:15
A2:
通過1: 06:10
通過2: 06:50
通過3: 07:20
A3:
通過1: 06:15
通過2: 06:45
通過3: 07:25
A4:
通過1: 06:20
通過2: 06:40
通過3: 07:30
A5:
通過1: 06:25
通過2: 06:35
通過3: 07:35

2024,江端さんの忘備録

NHKの『平安時代サミット2024 本当に「平安」だったのか』を見ました。

I watched NHK's "Heian Period Summit 2024: Was it really "Heian"?

いわゆる、今年の大河ドラマの番宣番組ですが、面白かったです。

It's a so-called "promotion program" for this year's history drama, but it was interesting.

今回は3つほど頂きました。

This time, I received three of them.

-----

(1)『平安時代の呪詛と、現代のSNSは同じである』

(1) "Curses in the Heian period and social networking sites today are the same."

至言だよなぁ、と思いました。

I thought, "That's a supreme word.

SNSの誹謗中傷は物理的な攻撃ではないのに、人を殺す力があります。

Social networking slander is not a physical attack, yet it has the power to kill.

これを「呪詛」と言わずに、何と言いましょうか。

What shall we call this without calling it a curse?

やはり、SNSなんぞには手を出さないのが良いのです。

After all, it is better to stay away from social networking sites.

(2)『光源氏が"クズ"なのは、もう共通認識ですよね』

(2) "It is already common knowledge that Hikaru Genji is a scumbag.

うん、もう、これはもう、議論の余地なく、奴はクズです。

Yeah, now, this is no longer debatable, the guy is a scumbag.

源氏物語

(3)『"光源氏"を"推し"と置き換えると、その存在を認めることができます』

(3) "If you replace "Hikaru Genji" with "fave", we can recognize its existence.

私、この"推し"は知っているのですが、上記のフレーズの意味が分からなくて、嫁さんに尋ねました。

I know this "fave," but I don't know what the above phrase means, so I asked my wife.

私:「これは、自分の応援している"推し"のアイドルであるなら、クズでも構わんということ?」

Me: "Does this mean you don't care if he's a bum as long as he's your "fave" that you support?"

嫁さん:「そういうこと。"推し"とは、何をしても許される存在のことだから」

Wife: "Right." A "fave" is someone who is allowed to do whatever he wants."

やっぱり私には良く分かりませんでしたが、『"推し"って怖いものなんだなぁ』ということだけは分かりました。

I still didn't understand it well, but I did understand that "fave" is scary.

-----

私が、今でも疑問に思っていることは、

I am still wondering about the question,

『なんで源氏物語は、検閲、発行禁止を免れたのだろう?』

Why did The Tale of Genji escape censorship and a publication ban?"

ということです。

だって、あの話、皇室への不敬のオンパレードですよ。

Because that story is a parade of disrespect to the imperial family.

当時、不敬罪があったかどうかは知りませんが、基本的に皇族に対する不敬が許される時代だったとは思えません。

I don't know if there was a crime of disrespect at the time, but I don't think it was when disrespect for the royal family was tolerated.

帝(桐壺帝)の妻(藤壺)を妊娠させておいて、この子の後見人になるなんて ―― どんな"托卵"だよ!と突っ込みたくなります。

How could he get the wife (Fujitsubo) of the emperor (Kiritsubo) pregnant and then become the child's guardian? I am tempted to say, "What kind of "mendicancy" is this?

-----

さらに、私が、本当に訳が分からんのが、一条天皇が「源氏物語の愛読者」だった、という点です。

Furthermore, I don't understand that Emperor Ichijo was a "lover of the Tale of Genji."

(一条天皇と藤原氏の関係は、説明が面倒なので割愛(ググって下さい))。

(The explanation of the relationship between Emperor Ichijo and the Fujiwara clan will be cut (please Google)).

フィクションとはいえ、自分の家系が、最大級の侮辱を受けている、とは思わなったのでしょうか。

Even though it was fiction, did Emperor Ichijo ever think that his family lineage was being insulted in the greatest possible way?

私、このあたりがどうしても良く分からないので、「源氏物語文学」に詳しい方に解説頂ければ、嬉しいです。

I am unsure I understand this part very well, so I would be glad if someone familiar with "Tale of Genji Literature" could explain it.

-----

ちなみに、上記の私の疑問に応える一つの解釈はあります。

By the way, there is one interpretation that answers my question above. That means,

―― 源氏物語は、あの時代における、異世界ファンタジーであった

"The Tale of Genji was an otherworldly fantasy of its time."

ということです。

または、実世界(α世界線)に類似した、別の世界(β世界線)だった、という、平行世界線解釈です。

Or, it is a parallel worldline interpretation that the real world (alpha worldline) was similar to another world (beta worldline).

ここに、私は、

Here, I would like to propose a new interpretation of

『源氏物語 ≒ シュタインズゲート』

"The Tale of Genji ≒ Steins;Gate."

という、新解釈を提唱したいと思います。