イラスト、モデリング、Unity、VR関連

unityとかblenderとかvr関連の作業メモ

銀河アリスちゃんの暗号解読プログラム

暗号はこれ

Rubyプログラム
B=7と大文字の法則性が不明だったので、これについては変換してない

text= "38.50.50.46.49.!.<.<.27.27.27.>.29.45.51.50.51.32.35.>.33.45.43.<.27.31.50.33.38.$.52.+.23.45.45.44.34.33.B.23.37.30.49"
text_ary = text.split(".")
az = [*"a".."z"]
dic = {"!"=>":" ,"<"=>"/" ,">"=>"." ,"$"=>"?" ,"+"=>"="}
res = ""
#w=27として数値を文字に計算する。
#アルファベットにおけるwからの距離と数値の差は一致している
#wは配列のインデックスは22
text_ary.each do |t|
  res << dic[t] && next if dic[t]
  if t.match(/\d+/)
    idx = t.to_i-27+22
    idx -= 26 if idx >= 26
    res << az[idx]
  else
    res << t
  end
end

puts res