Slashdot Mirror


Apple's Chess 2.0 Source Code Available

Petrochard writes "For all of you programmers who are big chess fans, check out Apple's release of Chess 2.0's source code. It would be cool if somebody could make a Simpson's Chess mod." Chess is based on sjeng (logic) and glChess (interface).

6 of 63 comments (clear)

  1. Re:Thats Nice of Them by squarefish · · Score: 2, Informative

    2.0 is the newer version that was released with panther

    --
    Creationists are a lot like zombies. Slow, but powerful and numerous. And they all want to eat our brains.
  2. Transparent Window Hack by kuwan · · Score: 3, Informative

    After taking a look at the source I found out that the floating window can be activated without making any modifications to the application. Here's how to enable the transparent window:

    Open Terminal.app and set MBC_DEBUG as an environment variable to 16:

    With bash:

    set MBC_DEBUG=16

    with tcsh:

    setenv MBC_DEBUG 16

    Now, open Chess.app from the Terminal:

    open /Applications/Chess.app/

    There will be a new menu item (Floating Board) under the "Game" menu. Selecting this menu item will toggle the floating board on and off.

    There seems to be a bug with the mouse behavior (I can't move any pieces) and I assume this is why this feature was removed. I found that you can get around this bug by doing the following:

    Start a game with the normal window.
    Play at least one move.
    Switch to the floating board.
    Select "Take Back Move" from the "Moves" window.
    You should now be able to move the pieces as normal.

  3. Re:Transparent window? by TomorrowPlusX · · Score: 3, Informative

    Well, I downloaded the source and examined it and I can tell you how to turn the transparent window back on.

    Comment out lines 741 through 744 of MBCController.mm -- funny, you've gotta love Objective-C++ -- half my work's in it too. You listening apple? Hire me ;)

    Specifically:

    [[fFloatingMenuItem menu] removeItem:fFloatingMenuItem];
    [[fFloatingView window] release];
    fFloatingMenuItem = nil;
    fFloatingView = nil;

    I found these pretty quickly -- particularly since the menu item *is* in the nib file, that meant I could just run a search for [someMenu removeItem: ] and whammo, there it was. You can thank me later.

    Above those lines is a call to getenv() looking up the string "MBC_DEBUG" so I gather you could simply set the parameter in your .profile, but I'm not certain how those parameters affect Gui apps. Quick run to the terminal and running Chess.app from there had no effect, but then, perhaps I'd have to log out and back in.

    Anyway, the above instructions will return the command-F floating window effect.

    Try to use it... then you'll understand why apple took it out. It's sad, because from a performance standpoint it's *fine*, the trouble is there's no way to drag or resize the window!

    --

    lorem ipsum, dolor sit amet
  4. Re:Transparent window? by javaxman · · Score: 2, Informative

    Ah, thanks for finding the key! No coding needed for this one - just dig into the Chess.app package, find the Info.plist ( only one level down ) and edit it. Apple has generaly pretty good documentation. The environment variable stuff is documented ( for the most part ) here : http://developer.apple.com/documentation/MacOSX/Co nceptual/BPRuntimeConfig/Concepts/EnvironmentVars. html The bit at the bottom of the page on setting application-specific environment variables says something about "The second way to associate environment variables with an application is to include the LSEnvironment key in the application's information property list." and includes a link to http://developer.apple.com/documentation/MacOSX/Co nceptual/BPRuntimeConfig/Concepts/PListKeys.html#/ /apple_ref/doc/uid/20001431/BCIJIJBH for more information. Anyway, by setting LSEnvironment in the Info.plist to include "MBC_DEBUG=(whatever)", you should be able to set up any of the associated behaviors. It looks like you want (MBC_DEBUG &16) to eval to false... so LSEnvironment "MBC_DEBUG=16" should do the trick. eh. Forget I said anything, it's probably easier to just comment out those lines and recompile...

  5. Re:Windowless Chess by tim1724 · · Score: 2, Informative

    Some versions of Chess 2.0 distributed with early builds of Panther did this. It had bugs (didn't calculate bounding box correctly, chopped off parts of the board if rotated the wrong way, etc.) and I guess they decided to take it out rather than fix it. (At least they got board rotation fixed .. that was unusable in early versions too.)

    --
    -- Tim Buchheim
  6. Re:GNU Chess by Portfolio · · Score: 2, Informative
    Sjeng happens to be the top rated open source chess program that can be compiled for OS X. All the other programs above Deep Sjeng on the SSDF rating list are commercial (except Ruffian, which is free but not open source).

    It probably doesn't hurt that Sjeng takes advantage of multiple processors and GnuChess does not.

    Ian