GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — grounded_evolution/beautify_readme.py at main · NullLabTests/grounded_evolution Expand file tree/ Copy pathbeautify_readme.pyMore file actions 64 lines (53 loc) · 1.97 KB / Copy pathbeautify_readme.pyFile metadata and controls64 lines (53 loc) · 1.97 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 """Update README status section with latest evolution metrics. Called from infinite_research_loop.py after each evolution cycle. Updates a small status block at the top of the README without disturbing the main documentation content. """ import re from pathlib import Path from datetime import datetime, timezone def beautify(best_score: float = 0, generation: int = 0, population_size: int = 0) -> None: """Update the evolution status block in README.md.""" readme = Path("README.md") if not readme.exists(): return content: str = readme.read_text() status_block: str = ( f"\n> **Last Evolution Cycle:** {datetime.now(timezone.utc).isoformat()} UTC \n" f"> **Generation:** {generation} \n" f"> **Best Score:** {best_score} \n" f"> **Population Size:** {population_size} \n" ) marker_start: str = "<!-- EVOLUTION_STATUS_START -->" marker_end: str = "<!-- EVOLUTION_STATUS_END -->" status_section: str = f"{marker_start}\n{status_block}\n{marker_end}" if marker_start in content and marker_end in content: content = re.sub( f"{re.escape(marker_start)}.*?{re.escape(marker_end)}", status_section, content, flags=re.DOTALL, ) else: content = content.replace( "## Overview", f"## Current Status\n\n{status_section}\n\n## Overview", 1, ) readme.write_text(content) if __name__ == "__main__": import json pop = Path("population/population.json") if pop.exists(): data = json.loads(pop.read_text()) if data: best = max(float(d.get("score", 0)) for d in data) beautify(best_score=best, generation=len(data), population_size=len(data)) else: beautify() else: txt_files = list(Path("population").glob("*.txt")) if txt_files: beautify(population_size=len(txt_files)) else: beautify() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |