[HN Gopher] Static Chess
       ___________________________________________________________________
        
       Static Chess
        
       Author : maxmcd
       Score  : 202 points
       Date   : 2024-05-13 12:56 UTC (10 hours ago)
        
 (HTM) web link (www.val.town)
 (TXT) w3m dump (www.val.town)
        
       | tr3ntg wrote:
       | I love this. Such a cool implementation. Fellow Val Towner here.
        
       | pimlottc wrote:
       | Doesn't seem to work on Mobile Safari? I can tap to select a
       | piece but tapping a target square to move doesn't do anything.
       | 
       | EDIT: seems like you need to tap the top edge of empty spaces?
        
         | maxmcd wrote:
         | yeah, I squashed a few bugs here but there is more weirdness.
         | will check it out
         | 
         | edit: ah! regular ol' relative/absolute position (been a bit
         | since I wrote css), this should now be fixed!
        
           | pimlottc wrote:
           | Working better, but I think some of the old static pages may
           | need to be regenerated?
        
             | msm_ wrote:
             | Probably cached by cloudflare, so either cache needs to be
             | flushed or you need to wait a bit.
        
         | digging wrote:
         | It appears only the top border of a space is clickable
        
       | theolivenbaum wrote:
       | Awesome work! You should put it behind a CDN like Cloudflare and
       | see what's the cache hit ratio
        
         | eertami wrote:
         | Lichess opening explorer would probably be a fairly accurate
         | indicator of how the cache hit ratios would develop:
         | 
         | https://lichess.org/analysis#explorer
         | 
         | I imagine it would look closer to the Lichess database, which
         | differs quite drastically from the Masters database. For
         | instance, with the masters e4 is met with c5 in 46% of games,
         | but on lichess c5 only happens in 19% of games.
        
       | d--b wrote:
       | Reminds me that I used to play chess by email back in the 90s.
        
       | zzh8829 wrote:
       | https://chess.maxmcd.com/rnbqk3/pppp2pB/2P1p3/1P1P2Bp/3n4/b2...
       | 
       | very cool, made it all the way to a checkmate
        
         | make3 wrote:
         | it would be cool if the url was just the chain of the moves.
         | then you just paste the move chain in the URL and you get the
         | board state.
        
           | staticfish wrote:
           | url length limitations may thwart that, unless it's all
           | compressed which might defeat the purpose
        
             | eertami wrote:
             | Chrome can supposedly support 32779 characters in the
             | address bar[0], and a legal chess game should not exceed
             | more than ~5900 moves, due to the 50 move rule. That will
             | be enough to encode any valid game if you don't need to
             | support IE.
             | 
             | [0]: https://stackoverflow.com/questions/417142/what-is-
             | the-maxim...
        
               | 6031769 wrote:
               | I bring good news. It's 2024 and nobody needs to support
               | IE any more.
        
           | maxmcd wrote:
           | huh, I originally thought this would create unusually long
           | URLs, but if it's just the sequence of moves it could stay
           | pretty small.
           | 
           | might more fun too, representing each state of play instead
           | of just the board position.
           | 
           | Also easily compressible if size is an issue:
           | https://mbuffett.com/posts/compressing-chess-moves
           | 
           | Would also mean all rules can be represented, and you'd be
           | able to do cool things like highlight the previous move that
           | was made.
           | 
           | Nice, ok, might try and add this.
        
           | Scarblac wrote:
           | It uses the FEN, which is the standard notation for chess
           | positions.
           | 
           | And it's the right choice, IMO -- if two positions are the
           | same they should have the same URL, regardless of the
           | specific move order used to reach it.
        
       | lxe wrote:
       | Learned about https://fav.farm and https://val.town from this.
       | Neat resources!
        
         | swyx wrote:
         | when is it useful to have a "quick favicon?"
        
       | yreg wrote:
       | Can double as a web spider trap.
        
       | candleknight wrote:
       | this gives me an idea for a new typescript type level project
        
       | throw9474 wrote:
       | Nice that it detects valid moves, But it doesn't know about
       | checkmate?
       | 
       | https://chess.maxmcd.com/r1b1kRnr/p1ppB2p/n2P2p1/8/7P/1p6/PP...
       | 
       | Should say checkmate?
        
         | michaelmior wrote:
         | It looks like the pieces are no longer movable so maybe
         | checkmate is detected but just not correctly displayed?
        
       | cmeacham98 wrote:
       | Fun fact: you can use this to play chess960 (i.e. fischer random
       | chess), or any other "custom start position" variant, just by
       | appending a FEN to the URL (replace spaces with underscores).
       | 
       | Example:
       | https://chess.maxmcd.com/bbnqrknr/pppppppp/8/8/8/8/PPPPPPPP/...
        
         | Scarblac wrote:
         | Chess960 also has different castling rules from normal chess
         | though, and the site can't know it should use those just from
         | the FEN?
        
           | anamexis wrote:
           | That depends - Chess960 doesn't have different castling rules
           | from normal chess, it just has additional considerations that
           | normal chess does not.
           | 
           | In other words, Chess960's castling rules are completely
           | consistent with normal chess castling rules, so depending on
           | how it is implemented, it might just work.
        
       | lemonlime0x3C33 wrote:
       | This is great to play asynchronously with people quickly and
       | simply :) Great job!
        
       | delichon wrote:
       | > When Google indexes this site will we successfully compute all
       | possible chess moves?
       | 
       | How do spiders know when to stop spidering when they keep getting
       | original content? I assume there's a Gordian solution to the
       | Halting problem like a limit to bytes or seconds. But if you
       | applied the same rules to ebay.com and val.town that doesn't
       | scale.
        
         | alexey-salmin wrote:
         | Big spiders neither stop nor start. If each webpage gives you
         | on average 200 new urls, you need to aggregate them, calculate
         | ranks and schedule the top 0.5% for crawling. Crawling capacity
         | is constant, the only question is the quality of your ranking
         | formula.
        
         | SonOfLilit wrote:
         | If I were Google, I'd limit bytes per site with the threshold
         | varying based on the site's rank.
        
       | whiskeytuesday wrote:
       | I was hoping this was going to be a chess variant where you're
       | not allowed to move any of the pieces.
        
         | SonOfLilit wrote:
         | Me too. In the meantime, check out Go for a similar but more
         | static game (more googleable by it's Chinese name Weiqi or its
         | Korean name Baduk).
        
       | javier_cardona wrote:
       | Pawn promotion is set to queen. You might want to add support for
       | other promotions... https://www.chess.com/forum/view/game-
       | showcase/checkmate-by-...
        
       | mandibles wrote:
       | See also: Type System Chess[0], in which the game rules are
       | expressed in the type systems of Rust and TypeScript.
       | 
       | [0]: https://github.com/Dragon-Hatcher/type-system-chess
        
       | jcparkyn wrote:
       | One of my personal projects uses a similar idea, but it's a word
       | game (scrabble-like) and it's hosted statically:
       | https://jcparkyn.github.io/scrobburl/
       | 
       | Repo: https://github.com/Jcparkyn/scrobburl
        
       | antiframe wrote:
       | This is great! I love the simplicity of it. I was hoping that
       | since it didn't require Javascript, it would work in the Emacs
       | Web Browser (EWW). Sadly, it doesn't render the grid properly.
       | Another niggle, when I moved my pawn to its last rank, it auto-
       | promoted to a Queen rather than prompt me.
        
       | Areading314 wrote:
       | I applaud the aim to make lean and fast websites, but the lack of
       | timer and drag+drop on this game makes it unusable, so I think
       | this actually makes the reverse point -- one should not put non-
       | functional requirements ahead of the function of a product. In
       | other words, this was not a good compromise.
        
       | mode80 wrote:
       | This is great. Suggest one additional bit to show black at the
       | bottom. That way the player of black is not handicapped by
       | playing from an upside down position.
       | 
       | Or just rip off the chess piece design of this other minimalist
       | chess board simulator, which is never upside down:
       | 
       | https://mirrorchess.com/
       | 
       | (It's ok, I made it.)
        
       | carom wrote:
       | Very cool. In addition to the FEN, it should have the move
       | history, maybe as a fragment.
       | 
       | For example -
       | https://chess.maxmcd.com/rnbqkbnr/ppp1pppp/8/3p4/3P1B2/8/PPP...
        
       ___________________________________________________________________
       (page generated 2024-05-13 23:00 UTC)