declare -A tile

An attempt at almost β€˜wave collapse algorithm’. Tiles with 4 nodes, to compare they must be shifted 2 chars. Only compare with left and top.

# Maybe
# ━ ┃  ┏ β”“β”— β”›  ┣ β”³ β”« β”»  β•‹
declare -A tile
tile[Β·]=____
tile[━]=_b_d
tile[┃]=a_c_
tile[┏]=_bc_
tile[β”“]=__cd
tile[β”—]=ab__
tile[β”›]=a__d
tile[┣]=abc_
tile[β”³]=_bcd
tile[β”«]=a_cd
tile[β”»]=ab_d
tile[β•‹]=abcd

Shift string (rotate the four nodes)

string="_bc_"                                                             
echo ${string:2:2}${string:0:2}
# c__b

# Which is actually a__d
# for first char on the left (d is not allowed) that becomes
# a___, fits are [┃]=a_c_ and [┣]=abc_ and [β”—]=ab__
┏  or ┏ or ┏ 
┃     ┣    β”—

To be continued…