frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Chess in SQL

https://www.dbpro.app/blog/chess-in-pure-sql
26•upmostly•2d ago

Comments

upmostly•2d ago
Author here.

I had the idea of building a working Chess game using purely SQL.

The chess framing is a bit of a trojan horse, honestly. The actual point is that SQL can represent any stateful 2D grid. Calendars, heatmaps, seating plans, game of life. The schema is always the same: two coordinate columns and a value. The pivot query doesn't change.

A few people have asked why not just use a 64-char string or an array type. You could! But you lose all the relational goodness: joins, aggregations, filtering by piece type. SELECT COUNT(*) FROM board WHERE piece = '♙' just works.

eastbound•23m ago
SQL can make 2D data, but it extremely bad at it. It’s a good opportunity to wonder whether this part can be improved.

“Pivot tables”: I often have a list of dates, then categories that I want to become columns. SQL can’t do that so there is a technique of spreading values to each column then doing a MAX of each value per date. It is clumsy and verbose but works perfectly… as long as categories are known in advance and fixed. There should be an SQL instruction to pivot those rows into columns.

Example: SELECT date, category, metric; -- I want to show 1 row per date only, with each category as a column.

``` SELECT date,

MAX( CASE category WHEN ‘page_hits’ THEN metric END ) as “Page Hits”,

MAX( CASE category WHEN ‘user_count’ THEN metric END ) as “User Count”

GROUP BY date;

^ Without MAX and GROUP BY: 2026-03-30 Value1 NULL 2026-03-30 NULL Value2 2026-03-31 Value1 NULL (etc) The MAX just merges all rows of the same date. ```

SQL should just have an instruction like: SELECT date, PIVOT(category, metric); to display as many columns as categories.

This thought should be extended for more than 2 dimensions.

FergusArgyll•52m ago
Very cool! I think the dragon is missing a white rook - ascii chess pieces are heard to see...
landsman•52m ago
Tool looks nice, but I would prefer such a tool written in a better (native?) language than JavaScript. Security is also important to me, so I only use open-source tools. I’m going to stick with DBeaver and DataGrip.
eelinki•51m ago
You could take this even further and add triggers to see if your move is legal or not. Or delete row with a conflict when you capture a piece.
grimm8080•27m ago
Amazing, how do I play it?
jimgoneill•20m ago
And they didn’t call it ChessQL?

Claude Code Unpacked : A visual guide

https://ccunpacked.dev/
132•autocracy101•1h ago•30 comments

Mad Bugs: Vim vs. Emacs vs. Claude

https://blog.calif.io/p/mad-bugs-vim-vs-emacs-vs-claude
25•Munksgaard•58m ago•19 comments

Neanderthals survived on a knife's edge for 350k years

https://www.science.org/content/article/neanderthals-survived-knife-s-edge-350-000-years
112•Hooke•5h ago•54 comments

Chess in SQL

https://www.dbpro.app/blog/chess-in-pure-sql
26•upmostly•2d ago•7 comments

TinyLoRA – Learning to Reason in 13 Parameters

https://arxiv.org/abs/2602.04118
148•sorenjan•4d ago•19 comments

TruffleRuby

https://chrisseaton.com/truffleruby/
103•tosh•3d ago•6 comments

Show HN: 1-Bit Bonsai, the First Commercially Viable 1-Bit LLMs

https://prismml.com/
208•PrismML•10h ago•86 comments

Bring Back MiniDV with This Raspberry Pi FireWire Hat

https://www.jeffgeerling.com/blog/2026/minidv-with-raspberry-pi-firewire-hat/
31•ingve•3d ago•5 comments

A dot a day keeps the clutter away

https://scottlawsonbc.com/post/dot-system
258•scottlawson•9h ago•81 comments

MiniStack (replacement for LocalStack)

https://ministack.org/
197•kerblang•10h ago•38 comments

The Claude Code Source Leak: fake tools, frustration regexes, undercover mode

https://alex000kim.com/posts/2026-03-31-claude-code-source-leak/
1097•alex000kim•17h ago•425 comments

Butterfly-collecting: The history of an insult (2017)

http://lughat.blogspot.com/2017/10/butterfly-collecting-history-of-insult.html
9•jruohonen•2d ago•0 comments

OpenAI closes funding round at an $852B valuation

https://www.cnbc.com/2026/03/31/openai-funding-round-ipo.html
413•surprisetalk•10h ago•360 comments

Analyzing Geekbench 6 under Intel's BOT

https://www.geekbench.com/blog/2026/03/analyzing-geekbench-6-under-intels-bot/
19•hajile•3h ago•12 comments

4D Doom

https://github.com/danieldugas/HYPERHELL
180•chronolitus•4d ago•40 comments

Slop is not necessarily the future

https://www.greptile.com/blog/ai-slopware-future
218•dakshgupta•16h ago•371 comments

Digitizing photos from the 1998 Game Boy Camera

https://swiftrocks.com/digitizing-photos-from-the-1998-game-boy-camera
23•rockbruno•2d ago•3 comments

Use string views instead of passing std:wstring by const&

https://giodicanio.com/2024/05/14/why-dont-you-use-string-views-like-std-wstring_view-instead-of-...
35•Orochikaku•2d ago•36 comments

Open source CAD in the browser (Solvespace)

https://solvespace.com/webver.pl
320•phkahler•18h ago•104 comments

Ordinary Lab Gloves May Have Skewed Microplastic Data

https://nautil.us/ordinary-lab-gloves-may-have-skewed-microplastic-data-1279386
91•WaitWaitWha•9h ago•30 comments

Show HN: CLI to order groceries via reverse-engineered REWE API (Haskell)

https://github.com/yannick-cw/korb
6•wazHFsRy•2d ago•0 comments

Why the US Navy won't blast the Iranians and 'open' Strait of Hormuz

https://responsiblestatecraft.org/iran-strait-of-hormuz/
262•KoftaBob•21h ago•702 comments

Back to FreeBSD – Part 2 – Jails

https://hypha.pub/back-to-freebsd-part-2
73•vermaden•4d ago•13 comments

Teenage Engineering's PO-32 acoustic modem and synth implementation

https://github.com/ericlewis/libpo32
105•ericlewis•4d ago•24 comments

Cohere Transcribe: Speech Recognition

https://cohere.com/blog/transcribe
183•gmays•14h ago•55 comments

Axios compromised on NPM – Malicious versions drop remote access trojan

https://www.stepsecurity.io/blog/axios-compromised-on-npm-malicious-versions-drop-remote-access-t...
1817•mtud•1d ago•735 comments

Show HN: Postgres extension for BM25 relevance-ranked full-text search

https://github.com/timescale/pg_textsearch
136•tjgreen•14h ago•40 comments

We intercepted the White House app's network traffic

https://www.atomic.computer/blog/white-house-app-network-traffic-analysis/
201•donutpepperoni•5h ago•60 comments

I traced my traffic through a home Tailscale exit node

https://tech.stonecharioteer.com/posts/2026/tailscale-exit-nodes/
105•stonecharioteer•11h ago•48 comments

From 300KB to 69KB per Token: How LLM Architectures Solve the KV Cache Problem

https://news.future-shock.ai/the-weight-of-remembering/
112•future-shock-ai•3d ago•9 comments