Is it Possible to Implement a Chess Game in Tiddlywiki

I was playing with

To me it seems not difficult to implement this interface in Tiddlywiki!
Using button, CSS, and SVG and some scripts behind!

I like to know if there are such games implemented in Tiddlywiki, specially Chess!

Yes :slight_smile:

https://Telumire.github.io/TiddlyTweaks/index.html#:[[Chess]]

I just copy/pasted the code from 1K Javascript Tiny Chess by Óscar Toledo G. ©2010 in an iframe on my wiki. His code is so tiny, it’s incredible …

Chess.tid (1.4 KB)

3 Likes

@telumire interesting implementation, provisioning scripts inside an iFrame, I see the bulk comes from the inclusion of the tiny_chess_1.html. I assume a copy of which could be stored along side a single file wiki?

I am interested in being able to publish other javascript in tiddlywiki even if it remains sandboxed in an iframe.

Perhaps at most we may copy and paste results into the wiki can you provide any generic guidance? In a new thread if necessary. Only if you have the time of course.

Back on August 16th: Just a goofy thought: a way to get javascript into a Tiddler

Really easy.

Slap HTML and javascript into a tiddler, and feed the content of that tiddler as ifame’s srcdoc parameter value .

1 Like

As a fun project for somebody having the time, the chess game could definitely be developed with native TiddlyWiki + HTML + CSS.

And that would be very cool.

I have nothing more to add beyond what @Charlie_Veniot said :slight_smile:

The proper way would be to create a wikitext or javascript macro but I just wanted to share this amazing little snippet of js. I don’t understand how it works (yet), so I probably wont be the one adapting it the “tiddlywiki” way … but I’d love to see it !

Hmm, doesn’t seem to understand castling.

EDIT: Or en passant.

1 Like

Yes he had to remove these features to met the challenge of writing a chess engine under 1Ko :

I had news of the contest in August 8 and came to my mind the challenge of writing a chess in 1K of Javascript, so based on my 2.2K Javascript chess in six hours I managed to crunch it to 1K. I had to remove castling, en passant and limit promotion to queen, leaving a simple chessboard with letters for chessmen, click in origin square and target square to move pieces.

I think this is the 2.2K version he’s talking about :
https://nanochess.org/archive/toledo_javascript_chess_3.html

Full article : Toledo Javascript Chess Game


PS: here’s the license, for those of you who’d like to make a proper port to tiddlywiki :

License terms for your Javascript chess?

It is free for non-commercial use, this includes all the forks, even those under the GPL as legally I’m the original author.

Please cite my name and website in any derivative source code or webpage where it is used. I would be glad to receive an e-mail telling me where you used it.

If you want to do commercial usage, just write me and we can reach a reasonable agreement.

Toledo Chess: Frequently asked questions

1 Like

In abstract terms, some of Cadbury’s APL folk managed it in a single line of vector rules in 1980, albeit with no strategy constraints, so the answer must be yes.

Sound interesting, what do you mean by that ? Can you provide a link to a paper or article explaining that concept/showcasing it ?

1 Like

It is certainly possible. I haven’t seen it or done it but I made the small interactive fiction game which had rules about as complex as chess.

I have been working on a movable grid macro in tiddlywiki that I am planning on using as a menu or alternate to the story river layout, but it could be used for chess once it is cleaned up a bit more and the logic for the rules is put into it.

As it is the thing I made uses just core widgets and some css and you can build a checkers or chess board with it, but there isn’t any rules checking so you can move pieces however you want.

I think that the host I use for my demo wikis is having caching problems or something like that so the example wiki isn’t showing up, I will post here when I figure out how to fix it.

1 Like

I have seen a chess plugin before. Not much logic but you can play against it, and possibly win. I will share If I find it.

It is an interesting idea. TBH I’d benefit not so much by live gaming as live illustration of Kasparov’s moves …

Just a comment
TT

My hosting thing decided that it would work again, so here is the site with the demo.

https://ooktech.com/jed/TiddlerGrid/

3 Likes

Ha! Very neat. One could do a bunch of things with that. Tx!

1 Like

This is great Jed, the eventcatcher/table combo has a lot of possibilities for games and I’ve noticed with some experiments of my own that, when hosted on Bob, it allows multi-player connections. i.e 2 players can move pieces on the same game from different machines on the same network. (At least on my local network, I haven’t tried it on an internet exposed wiki).

There is a lot to study and learn from in your macro. Thanks a lot. Not everything works for me yet on mobile/tablet (can’t drag the pucks on an ipad or android, but can drag the icons in the example below it). It might be the ‘mouse up/down’ that the touch screen doesn’t like, I’m not sure. I have had success with ‘on click’ with eventcatcher in my own experiments but I don’t have the ability to implement drag and drop and my mobile doesn’t like it anyway.

If you’re interested the experiment is here.

https://wattaged.github.io/popmap/#Popmap

Try it on a tablet or mobile and tap the first button on the ‘dash’ - set active pin to 1, close and tap the screen to move the pin about.

It’s not a game but It’s another example of game-like action using eventcatcher with a table. I guarantee that you are much better equiped to develop these possibilities. As you will see my ‘code’ is a mess and I am currently stuck on fixing pin positions relative to different screen sizes. Progress has stalled. I will study your methods and maybe try and take it further.

Best wishes

3 Likes