HN user

selfboot

12 karma

https://selfboot.cn

Posts3
Comments21
View on HN
[dead] 5 months ago

Hi HN,

I’ve always loved Simon Tatham’s puzzle collection — especially Bridges, Slitherlink, and Signpost. I’ve been playing them for years on desktop and Android.

Recently I decided to port the collection to iOS with a more modern native UI and some usability improvements, while keeping the original puzzle generation logic intact.

The core puzzle engines are still Simon’s original C implementations. I built a thin Swift layer around them and focused mostly on:

Native SwiftUI interface

Better touch interactions

Dark mode

Offline support

Fast puzzle generation

Clean, minimal UI (no ads)

A few technical notes:

The puzzle logic runs as compiled C modules bridged into Swift

Puzzle state is serialized/deserialized to allow undo/redo

I implemented a custom rendering layer to support dynamic grid scaling

All puzzles are generated locally (no backend)

One thing I found interesting is how well the original C codebase is structured — it’s surprisingly modular for something that supports so many puzzle types.

I tried to stay faithful to the original mechanics while improving the mobile UX.

Would love feedback, especially from anyone familiar with the original project or who has thoughts on puzzle UI design.

App link: https://apps.apple.com/us/app/simon-puzzles/id6756353841

Thanks Simon for building such a timeless collection.

[dead] 1 year ago

A deep dive into the creation process and internal structure of SSTable files in LevelDB. This article takes a problem-driven approach to analyze how SSTable achieves high read/write performance through mechanisms like block storage, index optimization, and filters. It focuses on the implementation details of the TableBuilder class, including the construction of DataBlocks, IndexBlocks, and FilterBlocks, as well as engineering techniques like index key optimization and compression strategies. Through source code analysis, it demonstrates how LevelDB solves key problems in large-scale data storage, quickly locating data blocks, reducing unnecessary disk I/O, and balancing storage space with query efficiency. With concrete code examples and flowcharts, the article helps readers deeply understand the ingenious design of the SSTable file format and the core implementation principles of LevelDB as a high-performance key-value storage engine.

[dead] 1 year ago

I have been trying for a long time but can't figure out how to play this game. Is there anyone who can give me some ideas?

The rules of the game are simple: jump over a piece to remove the jumped piece. Try to remove all pieces except one. Drag a piece to an empty space to move it. The target position must be exactly two holes away from the starting piece, the directions must be orthogonal, and there must be a piece in the middle hole. But I always end up with a few pieces that are far apart and can't be solved. What's the idea of playing this kind of game?

The original Simon Tathamʼs Portable Puzzle Collection has been a favourite of logic-puzzle lovers for decades, but it was written for the desktop environments of its time. This project brings those timeless games into the 21-st-century browser while preserving every rule, control and challenge you already know.

[dead] 1 year ago

This article delves into the implementation details of the high-performance LRU cache in LevelDB, covering its cache interface design, the LRUHandle data structure, doubly linked list optimizations, and sharding mechanism. By analyzing core designs like clever reference counting management, the dummy node technique, and lock sharding to reduce contention, it showcases the optimization strategies for an industrial-grade cache system. Combining code and diagrams, the article helps readers understand how LevelDB achieves a high-concurrency, high-performance cache and how these design techniques can be applied in their own projects.

[dead] 1 year ago

This article details the background and origins of MCP, its relationship with OpenAI Function Calling, and how to configure and use MCP Servers in Cursor. It explores practical scenarios like web automation, GitHub repository analysis, and chart generation. While MCP shows impressive capabilities in GitHub code analysis, web manipulation still has limitations. The article also highlights MCP's core constraint: its reliance on the LLM's function calling ability, which is affected by token limits. Although MCP offers a standardized solution for AI tool invocation, its practical value is currently limited, positioning it more as an experimental technology with hopes for significant improvements as model capabilities advance.

[dead] 1 year ago

This article provides an in-depth analysis of LevelDB's write mechanism, detailing the complete process from the Put interface to WAL logging and MemTable persistence.

Through source code analysis, it reveals how LevelDB achieves 400,000 writes per second throughput through core technologies like WriteBatch merging strategy, dual MemTable memory management, WAL sequential write optimization, and dynamic Level0 file throttling.

It also explores engineering details such as mixed sync write handling, small key-value merge optimization, and data consistency in exceptional scenarios, helping you master the design essence and implementation strategies of LevelDB's high-performance writing.

[dead] 2 years ago

If you’ve worked on any non-trivial C++ project, you’ve likely encountered process coredumps. A coredump is a mechanism where the operating system records the current memory state of a program when it encounters a severe error during execution.

There are many reasons why a C++ process might coredump, including:

Illegal Memory Access: This includes dereferencing null pointers, accessing freed memory, array bounds violations, etc. Stack Overflow: Caused by infinite recursion or large arrays allocated on the stack Segmentation Fault: Attempting to write to read-only memory or accessing unmapped memory regions Uncaught Exceptions: Program termination due to unhandled exceptions When encountering a coredump, we typically need to examine the core file for problem analysis and debugging. Analyzing core files can be challenging as it requires a deep understanding of C++’s memory model, exception handling mechanisms, and system calls.

Rather than focusing on core file analysis methods, this article will present several real-world cases to help developers proactively avoid these errors in their code.

[dead] 2 years ago

Zero front-end foundation, with cursor and claude 3.5 to implement a complete minesweeper game.

This Minesweeper game offers two game modes:

- *Classic Mode*: Traditional square grid minesweeper, identical to the one bundled with Windows. Each square is adjacent to eight neighboring squares (horizontally, vertically, and diagonally). - *Hexagonal Mode*: An innovative hexagonal grid minesweeper where each cell is a regular hexagon adjacent to six neighboring cells. This mode offers a fresh gaming experience, requiring players to adapt to new spatial relationships for logical deduction.

[dead] 2 years ago

Over the weekend, I used Cursor and Claude3.5 to create a complete maze game based on an existing maze generation library. You can try it at [Maze Game, Online Maze Generation](https://gallery.selfboot.cn/en/games/maze). It has comprehensive features, supporting various types of maze map generation and online maze gameplay using mouse controls.

Previously, when having Claude write code, I used well-known libraries with detailed documentation. AI models were already trained on these libraries, making it easy to write code.

However, this time, I used a [relatively obscure maze generation library](https://github.com/codebox/mazes) without documentation. Since the AI model had no knowledge of this library, getting AI to use it for my task was challenging.

[dead] 2 years ago

I have been using cursor and Claude3.5 to write some fun projects. Recently, I suddenly had the idea to quickly write a online sokoban game. So I took some time off on the weekend and used Claude3.5 to help me realize a complete box-pushing game.

It has many difficult levels built in, and also supports custom levels to share with friends.

Welcome to challenge!

[dead] 2 years ago

From time to time, I see some beautiful racing chart pages online, showing how data changes over time, which looks really cool. After researching, I found that there are ready-made JS libraries that can generate such charts, but I couldn't find a suitable tool that could automatically generate racing charts after uploading data.

So I thought about implementing one using Claude3.5, but the process wasn't smooth, and I encountered quite a few pitfalls along the way. I started working on it in July, trying intermittently multiple times, until recently when I finally managed to implement a simple version. This article records the process of implementing this tool using Claude3.5 and documents the pitfalls encountered along the way. You can experience the final result here, and feel free to leave comments for discussion.

[dead] 2 years ago

This article provides a detailed analysis of the time complexity of skip lists. By breaking down the search problem, reversing the entire search process, and finding an appropriate L level, it ultimately derives the time complexity of skip lists. Based on the understanding of time complexity, it further deduces how to choose the probability p, and the reasons for choosing the maximum height in Redis and LevelDB skip lists. Finally, it tests the performance of skip lists through a simple benchmark and compares it with unordered_map.

[dead] 2 years ago

OpenAI released a new model, o1-preview, claiming stronger code generation and understanding capabilities, with various evaluations showing good results. I immediately tried the new model, including using the popular prompt for generating SVGs with new Chinese interpretations, as well as explaining LevelDB code. Overall, the new o1-preview model shows improvement, but hasn't created a generational gap.

[dead] 2 years ago

Skiplists are probabilistic data structures that can replace balanced trees, offering fast insertion, deletion, and search operations. LevelDB's skip list implementation is concise, stable in performance, and suitable for storing data in memory MemTables.

This article starts by discussing the drawbacks of current binary search trees and balanced trees, introducing skip lists as a data structure. Then, based on the original paper, it explains the implementation principles of skip lists, followed by a detailed analysis of LevelDB's implementation code, including iterator implementation and extreme performance optimization for concurrent reading.

Finally, it provides a visualization page that intuitively shows the skip list construction process.

[dead] 2 years ago

This article explores the implementation of core utility components in LevelDB, including the Arena memory allocator, Random number generator, CRC32 cyclic redundancy check, and integer encoding/decoding tools. It analyzes the design considerations, implementation details, and optimization strategies of these components, demonstrating how they efficiently support various operations in LevelDB.

I am a backend service developer with no front-end development experience. I have never used modern front-end technologies such as react, and I don’t even know much about CSS layout. With the help of claude3.5 and gpt4, I built a complete website in less than a week, which includes several classic games and visualizations of common algorithms. AI changes the world!