XMoravec

Blog

I love writing. Read about my thoughts, technical deep-dives and adventures.

notes.ts

1def order_moves(board: Any, legal_moves: list[Any]) -> list[Any]:
2    ordered: list[tuple[int, Any]] = []
3    for move in legal_moves:
4        priority = 0
5        if board.is_capture(move):
6            priority += 100
7            if board.is_en_passant(move):
8                priority += PIECE_VALUES[1]
9            else:
10                target_piece = board.piece_at(move.to_square)
11                if target_piece is not None:
12                    priority += PIECE_VALUES.get(target_piece.piece_type, 0)
13
14        board.push(move)
15        if board.is_checkmate():
16            priority += 10_000
17        elif board.is_check():
18            priority += 50
19        board.pop()
20
21        ordered.append((priority, move))
22
23    ordered.sort(key=lambda row: row[0], reverse=True)
24    return [row[1] for row in ordered]
25
26
27def best_capture_or_random_move(board: Any) -> Any:
28    legal_moves = list(board.legal_moves)
29    if not legal_moves:
30        raise ValueError("No legal bot moves available")
31
32    best_capture_score = -1
33    best_captures: list[Any] = []
34    for move in legal_moves:
35        capture_score = 0
36        if board.is_capture(move):
37            if board.is_en_passant(move):
38                capture_score = PIECE_VALUES[1]
39            else:
40                target_piece = board.piece_at(move.to_square)
41                if target_piece is not None:
42                    capture_score = PIECE_VALUES.get(target_piece.piece_type, 0)
43
44        if capture_score > best_capture_score:
45            best_capture_score = capture_score
46            best_captures = [move]
47        elif capture_score == best_capture_score:
48            best_captures.append(move)
49
50    return random.choice(best_captures) if best_captures else random.choice(legal_moves)
Playground Lab Wordle gameplay screen with account-aware progress

A deep dive into gameplay and tool modules in Playground Lab: Wordle personalization, chess state and bot flow, server-authoritative clocks, tooling surfaces, leaderboard trust, and the incremental WebSocket roadmap.

GamesChessWordleLeaderboardsWebSocketsRoadmap
Read article

notes.ts

1@lru_cache(maxsize=1)
2def _load_ranked_words() -> tuple[list[str], str, bool, str | None]:
3    try:
4        ranked = top_n_list("en", EXTENDED_POOL_SIZE * 3)
5    except Exception as error:  # noqa: BLE001
6        logger.warning("wordfreq top_n_list failed; using fallback list error=%s", error)
7        return _fallback_result(type(error).__name__)
8
9    normalized = _normalize_words(ranked)
10    if not normalized:
11        logger.warning("wordfreq produced no valid 5-letter words; using fallback list")
12        return _fallback_result("empty-wordfreq-result")
13
14    return normalized, "wordfreq", False, None
Playground Lab chess interface used as architecture case study visual

A practical write-up of the architecture choices behind Playground Lab: decoupled services, internal trust boundaries, fail-fast startup, strict contracts, and production delivery trade-offs.

ArchitectureSecurityFastAPINext.jsMongoDBDev Notes
Read article
Blog

Published 02/16/2026 · 5 min read

Portfolio v1.0.0 Release Log: Fully Live, Fully Shipped

notes.ts

1const notes = {
2  title: "Portfolio v1.0.0 Release Log: Fully Live, Fully Shipped",
3  publishedAt: "02/16/2026",
4  tags: ["Release","v1.0.0","Production","Dev Log"],
5};

Final release entry for portfolio v1.0.0: production deployment complete, delivery and performance hardening finished, and all major planned requirements implemented.

Releasev1.0.0ProductionDev Log
Read article
Blog

Published 02/15/2026 · 5 min read

What My University Projects Still Teach Me Today

notes.ts

1bignum *bignum_fromstring(char *str) {
2  bignum* num = bignum_new();
3  bignum_enlarge(num, strlen(str));
4  for (unsigned int i = 0; i < strlen(str); i++) {
5    num->tab[i] = str[i] - '0';
6  }
7  return num;
8}

A readable reflection on three university repositories that still influence how I build software: BigNumbers, Proximity Messenger, and PB161 C++ assignments.

UniversityEngineeringReflectionCryptographyAndroid
Read article

notes.ts

1const notes = {
2  title: "From Baseline to Milestone: Where the Portfolio Stands Now",
3  publishedAt: "02/15/2026",
4  tags: ["Milestone","Product","UX","Dev Log"],
5};

One day after the initial snapshot, the portfolio moved into a much more stable late-stage shape: cleaner mobile UX, working contact delivery, bilingual-ready UI text, and tighter component structure.

MilestoneProductUXDev Log
Read article
Blog

Published 02/14/2026 · 2 min read

Portfolio Engineering Log: Current Technical Snapshot

notes.ts

1type BlogBlock =
2  | { type: 'heading'; text: string }
3  | { type: 'paragraph'; text: string }
4  | { type: 'quote'; text: string }
5  | { type: 'list'; items: string[] }
6  | { type: 'code'; language: string; code: string };

A technical snapshot of the current Next.js portfolio: architecture, content model, shipped routes, and concrete gaps still in progress.

Next.jsTailwindArchitectureDev Log
Read article