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

19 of 63 comments (clear)

  1. sjeng author wrote extreme vorbis encoder by ubiquitin · · Score: 3, Interesting

    The gentleman who wrote sjeng also wrote prototype Vorbis 1.0 encoder that can go down to bitrates of 4kbps that he claims can give a listenable stereo stream. IMHO that's bigger news than source to Chess.app 2.0.

    --
    http://tinyurl.com/4ny52
  2. scary by Tumbleweed · · Score: 4, Funny

    I think I'd be too intimidated to play chess against "the world's most powerful computer." Gosh. :)

    Joke aside, I'm eagerly awaiting the 970FX PowerMac, and VERY eagerly awaiting the 3gHz (980?) machines this summer. Ohhh yeahhh...

    1. Re:scary by tverbeek · · Score: 2, Funny
      I think I'd be too intimidated to play chess against "the world's most powerful computer." Gosh. :)

      My durn G5 whups me into next Tuesday every time I try to play against it. So does my G3 iBook. I like to think that an aptitude for chess is not the sole indicator of intelligence.

      --
      http://alternatives.rzero.com/
  3. Re:Thats Nice of Them by Otter · · Score: 5, Funny

    It's the bundled OS X chess game. You didn't think Mac users played _Solitaire_, did you?

  4. 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.
  5. Is this something new ? by javaxman · · Score: 4, Insightful
    While very cool, I have to ask if this is something new.

    The reason I wonder is that when I click on the "About Chess" menu item in Chess 2.0 as installed on OS X 10.3, I notice that in the lower right hand corner of the About window there is a button labeled "Download Source Code...". The button opens this page Apple - Public Source - Miscellaneous.

    So, while still cool, this is not likely to be "news". I do appreciate the pointer, though. It'll be nice to check out for programming ideas, as I'm getting back into Objective-C programming again.

    For folks wanting Simpsons mods and other simple image changes, though, you probably don't need the source for that, you just need to realize that the images are in the .app package... changing those really shouldn't require a recompile, should it?

  6. It can be done... by Crash+Culligan · · Score: 5, Funny
    I think it'd be sweet if somebody made the application so that the board just floated over the other windows, not inside of it's own window. I thought that's how it was supposed to be originally, but unfortunately I was wrong.

    One of the cornerstones of the current Cocoa-y way of doing things is that the front-end and back-end are separate beasts.

    Don't like the back-end? It's possible to build the app to use a program other than sjeng as its brain. It's just a matter of building with a new shell tool (and a little glue so the front-end knows how to use it).

    Don't like the front end? It's also possible to build a new wrapper app for sjeng that looks however you want it to. Use the source for the existing Chess program as a template for sjeng, and then go completely nuts. Screw reskinning, design a completely different and abstract chess game!

    But the windowless interface might be confusing to some users...

    55 W. P - e5
    55 B. P x P
    56 W. N x P
    56 B. B x System Preferences ?
    57 W. BitTorrent - A4 !!
    Kernel Panic in 4 moves
    --
    You cannot truly appreciate Dilbert until you read it in the original Klingon.
  7. Re:Simpsons been done to death by Entropy2016 · · Score: 3, Funny

    How about this setup?

    Pawn = The common zealous user, because once you go Mac you never go back. Also, there are those rare ones that go all the way to make the next killer app and become Queen-rich.

    Knight = Apple's engineers, because of the new & innovative ways in which they move...

    Bishop = User-group leaders, because someone has to shepherd the flock...

    Rook = Apple-lawyers, because everyone fears being pinned by the long-arm of the law...

    Queen = Woz, because that one piece has serious some skills...

    King = Jobs, because as soon as you think you've caught-up to him, he uses his reality-distortion-field to castle in a new direction. Also, no matter how little is left on the board, you can't quite nail him without a lawyer.

  8. Transparent window? by CODiNE · · Score: 4, Interesting

    Could somebody figure out how to re-enable the transparent effect that was in the Panther betas? It was a preference before, but now it's gone. In case some haven't seen it before, the board was floating with no background window. I don't remember if the window was transparent or actually able to be clicked-through, but it was very cool. :)

    I can't figure it out myself since I'm not a coder, but I've narrowed it down to MBCFloatingBoardWindow... no idea what to do with it tho. Any pointers? :)

    --
    Cwm, fjord-bank glyphs vext quiz
    1. 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
    2. 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...

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

  10. cheaters cheaters.. by seann · · Score: 2, Funny

    Now we can find out how how it cheats.

    --
    I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
  11. Re:The Licensce by geoffspear · · Score: 4, Funny

    Thanks! I was worried that opensource.apple.com was going to be slashdotted.

    --
    Don't blame me; I'm never given mod points.
  12. 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
  13. Little Diagrams by paulymer5 · · Score: 2, Interesting

    A friend and I were rooting through the code and decided to work with it a little. We've got grand ideas about networked chess, but haven't really done a whole lot besides draw lots of little complex diagrams. The chess code lends itself very well to lots of little complex diagrams.

    But we did notice some redundency in the code, probably because of the layering in the design. The position of the pieces, for example, are stored in several places (each of which is updated with each move). All of the validation routines pratically are screaming at us to go ahead and make modifications (even bad ones), because a surprising amount of errors are caught later on.

  14. This is absolutely not new. by gklinger · · Score: 2, Interesting

    When Apple released its first Panther beta, I was disappointed to discover that Chess was not included. However, Xcode was so I went to Apple, downloaded the source for Chess and had it up and running in under 5 minutes without reading any documentation (guilty). Suffice it to say, I was quite impressed with Xcode but that's another story. This is news, old news.

  15. GNU Chess by ParryHotter · · Score: 2, Interesting

    It's interesting to note that previous versions of MacOSX shipped a version based on GNU Chess and not sjeng. Does someone know why they changed the engine for this version?

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