11 ms·
Static Chess
- tr3ntg 2y agoI love this. Such a cool implementation. Fellow Val Towner here.
- pimlottc 2y agoDoesn’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?
- theolivenbaum 2y agoAwesome work! You should put it behind a CDN like Cloudflare and see what's the cache hit ratio
- eertami 2y agoLichess opening explorer would probably be a fairly accurate indicator of how the cache hit ratios would develop: https://lichess.org/analysis#explorer 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 2y agoReminds me that I used to play chess by email back in the 90s.
- zzh8829 2y agohttps://chess.maxmcd.com/rnbqk3/pppp2pB/2P1p3/1P1P2Bp/3n4/b2r1q2/P1K5/RN1Q3R_w_q_-_7_24/ https://chess.maxmcd.com/rnbqk3/pppp2pB/2P1p3/1P1P2Bp/3n4/b2... very cool, made it all the way to a checkmate
- make3 2y agoit 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 2y agourl length limitations may thwart that, unless it's all compressed which might defeat the purpose
- eertami 2y agoChrome 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-maximum-length-of-a-url-in-different-browsers/417184#417184 https://stackoverflow.com/questions/417142/what-is-the-maxim...
- 6031769 2y agoI bring good news. It's 2024 and nobody needs to support IE any more.
- capitainenemo 2y agoInteresting. According to that stackoverflow, Chrome is one of the shortest URL lengths of the modern browsers (firefox/safari/chrome). However, it also notes you have to take CDNs and web servers and search engines into consideration, so the ginormous length limits of safari and firefox probably won't be useful any time soon.
- 2y ago
- lxe 2y agoLearned about https://fav.farm https://fav.farm and https://val.town https://val.town from this. Neat resources!
- swyx 2y agowhen is it useful to have a "quick favicon?"
- lxe 2y agowhen you're just hacking on stuff
- Retr0id 2y agoWhen you're making a project just like the linked one.
- thomascountz 2y agoNot OP, but having a favicon—any favicon, really—during prototyping helps me get a feel for my project's identity, and, more pragmatically, gets rid of incessant 404s.
- ggorlen 2y agohttps://fav.farm https://fav.farm seems like a cool service at first, but it doesn't actually do a whole lot. I'd just assume inline the one-liner they mention (similar to https://css-tricks.com/emoji-as-a-favicon/ https://css-tricks.com/emoji-as-a-favicon/) and avoid the external dependency for the price of 117 characters.
- candleknight 2y agothis gives me an idea for a new typescript type level project
- yreg 2y agoCan double as a web spider trap.
- throw9474 2y agoNice that it detects valid moves, But it doesn't know about checkmate? https://chess.maxmcd.com/r1b1kRnr/p1ppB2p/n2P2p1/8/7P/1p6/PPP2PP1/RN2KBN1_b_Q_-_5_17/ https://chess.maxmcd.com/r1b1kRnr/p1ppB2p/n2P2p1/8/7P/1p6/PP... Should say checkmate?
- michaelmior 2y agoIt looks like the pieces are no longer movable so maybe checkmate is detected but just not correctly displayed?
- jtriangle 2y agoIt also doesn't allow en passant
- skribanto 2y agoe4 d5 e5 f5 exf6 This simple en passant works
- deadbabe 2y agoWow, I’ve never even heard of en passant. These kind of niche obscure rules seem antithetical to the elegant nature of chess.
- bluedevil2k 2y agoThis and castling strike me as the kind of rules where a King like Henry VIII was losing and decided to castle for the first time ever and his opponent was too scared to say anything to stop it.
- zelphirkalt 2y agoOn one hand this kind of rules seem like tacked on, artificial, but on the other hand en passant has been introduced for a good reason and chess would be quite dull without it.
- daniel_levine 2y ago
- cmeacham98 2y agoFun 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/BBNQRKNR_w_KQkq_-_0_1/ https://chess.maxmcd.com/bbnqrknr/pppppppp/8/8/8/8/PPPPPPPP/...
- Scarblac 2y agoChess960 also has different castling rules from normal chess though, and the site can't know it should use those just from the FEN?
- anamexis 2y agoThat 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.
- vikingerik 2y agoIt depends on how exactly you define it. If the standard rule is as commonly taught "king moves two spaces and the rook hops over", 960 isn't the same. If the rule is "king moves to c or g file, rook moves to d or f", then it is the same. Those rules are equivalent for standard chess but only the latter ports to 960 properly. (We're probably agreeing, in that's what you mean by depending on the implementation, I'm just spelling it out.)
- anamexis 2y agoIndeed - perhaps you could say that 960's castling rules are a superset of normal castling rules. Edit: Actually, I think the other way around is more accurate - 960's castling rules are a subset of normal castling rules.
- 2y ago
- lemonlime0x3C33 2y agoThis is great to play asynchronously with people quickly and simply :) Great job!
- delichon 2y ago> 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 2y agoBig 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 2y agoIf I were Google, I'd limit bytes per site with the threshold varying based on the site's rank.
- toast0 2y agoThere's a lot of heuristics. Big sites get more crawl time. Some crawlers will back off if pages are slow. There's usually some sort of 'interestingness' calculation, so repetitive content won't get crawled as much.
- whiskeytuesday 2y agoI was hoping this was going to be a chess variant where you're not allowed to move any of the pieces.
- SonOfLilit 2y agoMe 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).
- chuckadams 2y ago"go game" works great for search too.
- deleted 2y ago[deleted]
- dullcrisp 2y agoIt is if you don’t click the links!
- javier_cardona 2y agoPawn promotion is set to queen. You might want to add support for other promotions... https://www.chess.com/forum/view/game-showcase/checkmate-by-promoting-to-knight https://www.chess.com/forum/view/game-showcase/checkmate-by-...
- daniel_levine 2y agoFork it!
- mandibles 2y agoSee 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 https://github.com/Dragon-Hatcher/type-system-chess
- jcparkyn 2y agoOne 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/ https://jcparkyn.github.io/scrobburl/ Repo: https://github.com/Jcparkyn/scrobburl https://github.com/Jcparkyn/scrobburl
- antiframe 2y agoThis 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 2y agoI 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 2y agoThis 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/ https://mirrorchess.com/ (It's ok, I made it.)
- jmpavlec 2y agoAll pieces can move everywhere...? And no rules seem to be in effect. What's the purpose of this?
- carom 2y agoVery 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/PPP1PPPP/RN1QKBNR_b_KQkq_-_1_2/#d4-d5-Bf4 https://chess.maxmcd.com/rnbqkbnr/ppp1pppp/8/3p4/3P1B2/8/PPP...
- porphyra 2y agoIt's a neat demo but surprisingly laggy for a static webpage that has a minimalistic implementation of chess.
- ziml77 2y agoSurprising? It has to round trip to the server and grab a new page on every click.
- deleted 2y ago[deleted]
- bbor 2y agoHaha this one got me good. I was poking around the code looking for how the url is transformed into a chess board state, but its JavaScript in 2024 so of course my journey was a short one ending in an NPM import. You’ve gotta laugh, you’ve just gotta laugh… Obviously very cool idea and implementation tho! I think the answer to the google question is “probably”
- cutler 2y agoFull version hijacked my Back button on Firefox/Android.
- re 2y agoI did something nearly identical to this for the board game Reversi as part of an exercise to teach myself Python, except the opponent was always a simple minimax search-based AI. This was back in 2006, though, so I suppose doing it without JavaScript and putting all of the state into the URL was a lot more obvious of an approach back then compared to today. :)
- dsizzle 2y agoThere's no sitemap (https://chess.maxmcd.com/sitemap.xml https://chess.maxmcd.com/sitemap.xml) - I was hoping to find a list of all possible chess states lol
- zazaulola 2y agoWhy are you surprised? The chess AI engine was crammed into 1kb of javascript code. That was back in 2010 https://js1k.com/2010-first/demo/750 https://js1k.com/2010-first/demo/750
- da4id 2y agoIs there a valtown for Python?
- peabnuts123 2y agoThis isn't really static right? It's still dynamically rendered by the backend each time you request the page. There aren't 999999919291293923 pre-rendered pages living on a server somewhere.
- cachvico 2y agoStatic as in no XmlHttpRequest.
- hollerith 2y agoI can start a game on Lichess, resign it right away, enter analysis mode, then disconnect from the internet and continue to use the board (in the same way that one can use the board on site we are discussing here), so Lichess's analysis board does not use XmlHttpRequest either.
- Sesse__ 2y agoYou don't need to resign a game to enter analysis mode. It's available from the menu.
- deleted 2y ago[deleted]
- PetahNZ 2y agoIt doesn't even really need to be rendered by a backend. An SPA with pushState and it could literally be just a single file.
- deleted 2y ago[deleted]
- tromp 2y agoTechnically speaking, it would require ~ 4.8 * 10^44 pages to cover all legal chess positions [1]. But they're happy to serve utterly illegal positions like https://chess.maxmcd.com/rnbqkbnr/qqqqqqqq/8/8/8/8/QQQQQQQQ/RNBQKBNR_w_KQkq_-_0_1/b1 https://chess.maxmcd.com/rnbqkbnr/qqqqqqqq/8/8/8/8/QQQQQQQQ/... as well. [1] https://github.com/tromp/ChessPositionRanking https://github.com/tromp/ChessPositionRanking
- Mr_Minderbinder 2y agoSimilar idea using GNU chess: http://chess.delorie.com/ http://chess.delorie.com/
- danielohrlund 2y agoVery nice!
- p0w3n3d 2y agoBruteforcing all the possible moves into a static set of files. I wonder how much space it does occupy, considering that small files take more space than large files with the same amount of bytes
- onehair 2y ago> Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves? > Functionality is quite limited, and things might be broken. Please let me know if you find bugs! Not sure if the first paragraph boasts the pros or the cos of this sort of implementation. It's one thing to market implementations done in unusual ways with the intent of exploring the possible. It's another to portray software implemented with the right technologies as : bloat, silly animations, slick interactivity to trip up your gameplay. It doesn't help that the second paragraph showcases shortcoming of this kind if implementation. It could all just be sarcastic and I fell for your trap. Well played and clever implementation!
- tucnak 2y ago[flagged]
- Hugsun 2y agoI'd wager that it's a humorous description, taking certain virtues to an illogical extreme. The limited functionality is nevertheless likely referring to features beside the ones described as bloat.
- helboi4 2y agoYeah the idea that you wouldn't want animations in a GAME is hilarious. It must either be a joke or this person is really that far up the "the web shouldn't have js" culty asscrack.
- Hugsun 2y agoI already love the architecture and I'm excited about brutalist software. Great idea! We need a brutalist software manifesto.
- incorrecthorse 2y agoLooks like this missed the opportunity to load the board in JS from the URL to be truly static.
- donatj 2y agoI’m frankly kind of bummed that this isn’t fully static chess. As in every possible move is a pre-rendered html file on a server somewhere. This is more akin to how Yahoo Games and other chess sites worked in the early aughts.
- oneeyedpigeon 2y agoI think a compromise would be more practical: every position that has actually occurred as a pre-rendered html file, with novel positions generated dynamically.
- Jeremy1026 2y agoWas just playing around a little and found a bug. In the following position it won't let me play F8. https://maxm-staticchess.web.val.run/rnb1kbnr/pp2P1pp/3p4/q1pQ1p2/8/8/PPP1PPPP/RNB1KBNR_w_KQkq_-_1_6/c2 https://maxm-staticchess.web.val.run/rnb1kbnr/pp2P1pp/3p4/q1...
- RespiceFinem 2y agoIt's not a bug. f8=X is illegal since white is in check from the Queen on a5.
- Jeremy1026 2y agoSure is. That what you get for just clicking around randomly and not paying attention to what is where.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- arh5451 2y agoOnly issue I see is that it does not identify check mate.
- tantalor 2y agoThat's not what "static" means
- afauroux 2y agoI did a static chess page myself some time ago but with p2p connection (using webRTC) so you can play with a friend: - [Try it](https://afauroux.github.io/chess/ https://afauroux.github.io/chess/) - [Fork it](https://github.com/afauroux/chess https://github.com/afauroux/chess)
- pushedx 2y agoI really like the sound effects. Especially check.
- afauroux 2y agoThanks, I made them with GarageBand and Audacity, I think. The check sound is made from a recording of my girlfriend with added echoes ;-)
- angry_albatross 2y agoI noticed a weird bug where sometimes the game will auto-move for a player. In particular, this seems to happen when one queen captures a piece, and the opposing side has the ability to capture that queen with their queen, the game automatically makes the 'queen takes queen' capture.
- wonjun 2y agonice effort, val.town is cool, too
- _factor 2y agohttps://chess.maxmcd.com/rnbqkbnr/pppppppp/8/8/8/4P3/PPPP1PPP/RNBQKBNR_b_KQkq_-_0_1/ https://chess.maxmcd.com/rnbqkbnr/pppppppp/8/8/8/4P3/PPPP1PP...