Download Game! Currently 128 players. Last logged in:AnksCilwandLysanderPorkzar

Blitzer's Blog >> 72596

Back to blogs index
Posted: 20 Sep 2026 16:13 [ permalink ]
def format_markdown(hierarchy):
    md = "# AST-MD: Hierarkkinen KC$yttC6liittymC$kartta

"
    
    for section in hierarchy:
        cls = section["classification"]
        fid = section["frame_id"]
        fb = section["bounds"]
        
        md += f"## {cls} ({fid})
"
        md += f"> Alueen rajat: X:{fb['x']}, Y:{fb['y']}, W:{fb['w']},
H:{fb['h']}

"
        
        for n in section["nodes"]:
            if n['type'] == 'TextNode':
                md += f"  - `[{n['id']}]` **Text**: \"{n['content']}\"
(X:{n['x']}, Y:{n['y']})
"
            else:
                md += f"  - `[{n['id']}]` **Icon**: *{n['content']}*
(X:{n['x']}, Y:{n['y']})
"
        md += "
"
        
    return md

if __name__ == "__main__":
    start_time = time.time()
    img_pil = ImageGrab.grab()
    img_np = np.array(img_pil)
    gray = cv2.cvtColor(img_np, cv2.COLOR_RGB2GRAY)
    
    ast_tree = build_hierarchical_ast(gray)
    md_output = format_markdown(ast_tree)
    
    print("
" + "="*60)
    print(md_output)
    print("="*60)
    print(f"[+] Hierarkkinen AST valmis ({(time.time()-start_time):.2f}
sekuntia).")