Please don’t mind that the player character is a chameleon. Please do mind that it’s working over D-Bus.
Posts Tagged ‘KDE’
12 Sep
Sneak-peek preview
29 Aug
Season’s End
During this summer, I participated in the Season of KDE, working on a Octave backend for Cantor with my mentor and Cantor author Alexander Rieder. I’m proud to say I have achieved my goal. In addition to running Octave commands directly from Cantor’s worksheet, all convenience features supported by both Cantor and Octave support are available:
- Syntax highlighting for functions, variables, operators and strings
- Tab-completion
- Easy access to function documentation / syntax help
- Easy 2D and 3D plotting of functions, with plots integrated in the worksheet
- Linear algebra extension for defining matrices and computing their inverse, eigenvectors and eigenvalues
- Integrated script editor and runner
- Possibility to interrupt or restart Octave at any time
I haven’t been really regular with blogging, so I would like to apologize and give you something better in return: a screencast. Please excuse my bad english and strange voice, I’m really not a good speaker in any language.
Also, it was only after I finished that I remembered it would be better to make a presentation with untranslated Cantor. I hope I explained everything I did well enough.
I would really like to thank the KDE team (especially Lydia) for organizing this, and my mentor Alexander for help and guidance (and finding me more things to do
). I will certainly continue working on (and with) KDE.
26 Aug
Knights 2.1
Today I decided to release the next version of Knights 2, the KDE4 port/rewrite of Troy Corbin’s great chess program. For this release I have to thank Dave Kaye, who not only added, fixed and improved themes, but also bugged motivated me to support his new features in the code. Also, a thank you goes to Thomas Kamps and his rendered clock.
It can be downloaded from kde-apps or directly from Dropbox.
It took quite a lot of time to get here, because I had other obligations, but I hope you’ll be satisfied with the result. These are the main new features:
- Support for playing on the Free Internet Chess Server
- Markers on the board for legal moves, last opponent’s move and danger to your king
- Graphical clock display
- Several new fully-scalable themes
- Some animation changes, now it’s also possible to animate the entire board.
- Small fixes: victory dialogs, configuration icons, …
There have also been some more technical changes:
- Port to KGameRenderer, which is now an optional compile-time dependency.
- Changed element names in themes. Anyone interested in theming please take a look at some of the existing ones, for example the XBoard one.
Please test the new version, either against trunk (will use KGameRenderer) or with any other KDE version. The part about which I’m the most curious is playing on FICS, because I’m not a regular player there and don’t know what king of games are played there. Any input about it will be appreciated. If there aren’t any major flaws found, I will try to move to kdereview before 4.6 is released.
Share and Enjoy!
24 Aug
Highlighting in Cantor
Disclaimer: another post about 4.6 when 4.5 is barely out. Please don’t hate me. If you do anyway, scroll to the end of the post.
When I started working on Cantor, most of its highlighters worked like this:
There was a struct HiglightingRule with two members: a QRegExp and a QTextCharFormat. The highlighter would make a QList of these rules, iterate over them every time the cursor moved, and formatted all matches of each regex with the associated format. As there could be a lot of these rules (~1600 for Octave), things could get slow. The other backends didn’t have that many rules, that’s why I was most bothered with it. Thousands of iterations and especially regex-matchings for every key pressed is really too much for my poor laptop. It was enough to make scrolling non-smooth. Because QSyntaxHighlighter can’t easily be made asynchronous, holding down the right arrow key caused the cursor to hang and jump randomly.
Fortunately, Alexander (Cantor’s author) and Oleksiy (who works on the R backend) tried a different implementation: The text was broken down into words, and each word checked against a database. We then decided that a database is not needed and I replaced it with a QHash<QString, QTextCharFormat>. Iterating over 1600 regexes was replaced with iterating over less than ten words and searching for them in a hash.
I preserved the QRegExp-based API for things like strings (‘.*’ and/or ".*"), but most of the rules are now converted to the word-based highlighting. Even without a proper benchmark, it’s obvious that scrolling is much faster now. It’s also not something screenshot-worthy, so I have to disappoint you again. Please don’t hate me again.
Final note for spoiler-haters: Even though I’m talking like I’m already skipping it, and I don’t have it because it’s not in Arch yet, there is something special for me about the 4.5 release. It’s the very first release of KDE with a piece of my code. Quite literally a piece, because in total it’s two new lines, but it makes me prowd. I added auto-prefetching to the Comic plasmoid.
19 Jun
Octave-backend improvements
I’m having a bit of a pause between the exams, so I’m doing some hacking on the new Octave backend for Cantor. Thing are going very well, probably better (especially faster) that I expected.
The basic input-output sending between Cantor and the command-line process was working some time ago, and I recently added support for embedding graphics into the worksheet.
This week I was working on cosmetics: Autocompletion, syntax highlighting and pop-up help.
Completion was easy, octave provides a completion_matches() function which takes a string argument and return all functions and variables starting with that string.
Syntax help was also quite straightforward, through the use of Octave’s built-in help() command. Highlighting was where I spent most of the time, because as a command-line program Octave has no native support for it.
There’s a handy command called ‘who’ that lists all currently visible variables, so I retrieved the variable name list with it and used it in the highlighter. I then hardcoded a list of all recognised operators and keywords.
The toughest nut was getting a list of all functions from Octave. There’s no (at least known to me) equivalent to ‘who’ for functions, so I had to improvise. I didn’t want to hardcode all the functions, as is done for the Maxima backend, because, as we all know, hardcoding is bad, and there’s always the possibility of future changes to Octave language. The closest I could get is using completion_matches() with an empty string, but that returns all the internal constants, environment variables, and files in the current directory. I filtered them out the best I could, and the end result work well, despite there being more that 1600 functions.
Another think I worked on this week is getting as much plotting code as possible from C++ to an octave script. This not only unclutters the worksheet (there used to be a long line of commands instead of cantor_plot#d()), but makes simple changes to plotting faster by not requiring a recompile. Tweaking the size of the plot to prevent it from filling the whole page didn’t even need a new session, just an update to the script.
5 Jun
Knights and FICS
As of yesterday, Knights 2.0 is able to connect to freechess.org and play a complete game there. I committed to playground today, feel free to compile it from there.
I wasn’t able to test it completely, and the code is probably missing some error checking, as well as cleanup, but the functionality is there.
Screenshots follow soon, I hope.
9 May
Knights in the playground
Knights, the KDE 4 chess board, is now in KDE playground.
The code part is pretty much ready to be reviewed and released, however the default theme is only in the PNG format, while KDE’s themes are usually in the scalable SVG. This leaves some artifacts on the board, like black lines between tiles. As I’m far (very far) from being an artist, I’ll need some help there.
There have also been some changes since the last release on kde-apps.org, notably the introduction of clocks and time limits. I’m still unsure how to implement them for computer engines, to make them realize they have a limit and play accordingly. Also, I will have to include network play some time, and I don’t have any ideas about what to do with time limits there. I might just as well enable them for local play only.
I also just committed the change to use Knights’ old application icons. It looks nice, although it would fit in better with some more transparency.
=-=-=-=-=
Powered by Blogilo
24 Mar
KChess first beta released
I decided to release the first test version of KChess to the public.
http://kde-apps.org/content/show.php/KChess?content=122046
=-=-=-=-=
Powered by Blogilo
10 Feb
KDE Software Compilation 4.4 Released
So, the new version is officially out. As I’m already running trunk on one machine, I know the most important new features. However, the official announcement showed me many, altough minor, useful new things. It’s awesome.
Apart from the software getting better and better, a big heads-up goes to the kde.org website. It’s been completely redesigned, from its KDE3-like look to a more Plasma look. Very nice. If you’re not interested in the program, at least take a look at the release announcement. It’s really well done, and finally the website reflects the quality and the comfy look-and-feel of the software.
28 Jan
Castling and en-passant moves in KChess
I finally completed the code reqiured for these special move rules in KChess.
Next up in line: Pawn promotions, and two-player hotseat mode.



