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).

2 of 63 comments (clear)

  1. 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.

  2. 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