Qindar for Windows 3.0 released
Posted by jimblackler on Oct 24, 2007
I received another request by email to update one of my wordgame programs to use the latest CSW dictionary. This time the program was Qindar for Windows (as opposed to my AJAX website Qindar.net).
As it happened I’d been sitting on an updated of Qindar for Windows for a while. Not only had I modernised the dictionaries I’d also added an analyse mode where the valid games for each turn can be viewed after a game. (They can even be viewed during the game if you turn the option on in the settings).
Not only that you can perform a basic “simulation” on moves to estimate the relative strategic value of each alternative.
Other improvements include a challenge mode other than ‘void’, plus the bots from Qindar.net. As all my wordgame programs use the game logic engine it’s easy to port over the benefits.
I’d not put this version out because I’d put a few bugs in somewhere along the line so I wanted to polish it a bit first. I’ve done that now, so I present to you Qindar 3.0. (click) Please do email me or comment here if you find any bugs with it.
Standard whitespace, Visual Studio style
Posted by jimblackler on Oct 15, 2007
Stressing about standard code appearance in a large team project is fairly low on my list of priorities, but it is on the list.
I’m happy to change my style to fit in, but as every project has a different ‘standard’, it’s annoying to have to keep changing.
“The wonderful thing about standards is that there are so many of them to choose from.” Grace Hopper
Visual Studio has, from VS 2002, offered a facility to ‘format’ some code files. This format actually means convert the whitespace to a standard form. This form is apparently of Microsoft’s own design.
I was delighted to see this feature, however, as it meant that there was an easy way that a common format for whitespace could be set in a large team. Yes there are formatting utilities out there, and VS is just one of the many IDEs available. VS is however a very popular IDE in the world of commercial development.
The actual keypresses and modes vary by language, VS version, and configuration. In some modes it is automatic, in others you can press CTRL-E-D. You can format C++, C#, Visual Basic or XML. The .NET languages have controllable options and seem to format more effectively.
Over the last couple of years I’ve got so familiar with the VS format that I apply the style manually when working with non-VS languages like Javascript, Actionscript and PHP.
I have reversed engineered the default VS style so that you can do the same if you like! These are the basics. The general rule is that all tabs and spaces are stripped with the exception of:
Indentation
Braces appear on a line of their own (controversial!) at the same indentation level as the parent. Block content appears indented.
- class MyClass
- {
- int Method()
- {
- return 3;
- }
- }
Case labels and content are each indented.
- switch (name)
- {
- case "John":
- break;
- }
Comments appear in the first column without indentation.
Indentation is not changed for the second and further lines for any instruction that spills over multiple lines. The default however is that it is indented from the first line.
- {
- bool receiveMessage( Stream & stream,
- int & header, int & size );
- }
Spaces after keywords
Spaces are placed between keywords (if, switch, for, return, etc.) and the content that follows, unless it is ;. So you have
- return (x);
.. which contrasts with no space in a function call such as ..
- SomeFunc(x);
Spaces between mathematical operators
Brackets are not followed by spaces, but a single space appears between other mathematical operators.
- int y = (3 + 4 / 2 - 6 + (4 + 2 * array[4]));
Spaces after commas and semicolon separators
- SomeFunc(4, x, 5);
- for(int count = 0; count != 9; count++)
- {
- }
That’s pretty much it. It’s a simple summary, no doubt a more accurate, formal one could be prepared. But that’ll give you the basics
Other aspects of code standardisation such as standard naming conventions are not currently supported by VS. It would be interesting to see an optional scheme where violations of some convention could be flagged as errors.