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

63 comments

  1. Simpsons been done to death by lambent · · Score: 1


    I think it would be more interesting if someone somehow skinned the Woz for this.

    1. Re:Simpsons been done to death by Anonymous Coward · · Score: 0

      How about making the black pieces with orcs, nazguls and Bill Gates as the queen?

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

    3. Re:Simpsons been done to death by Anonymous Coward · · Score: 0

      Flamebait? Come on mods, this is funny!

  2. Re:yeah by Anonymous Coward · · Score: 0

    Not to mention how much they improved KHTML while working on Safari. Apple does really do a lot for OSS.

  3. 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
    1. Re:sjeng author wrote extreme vorbis encoder by Anonymous Coward · · Score: 0

      What's "Vorbis"?

    2. Re:sjeng author wrote extreme vorbis encoder by Bombcar · · Score: 1

      Check it out!

      You won't believe your ears!

      Try Sultans of Swing in 197K!

      Amazing! This is truly insane!

      Apple, you must support Vorbis. If the iPod does Vorbis, I buy one, and that's a promise.

    3. Re:sjeng author wrote extreme vorbis encoder by Yarn · · Score: 1

      It's very impressive, but I don't think I could listen to it for any length of time.

      As for vorbis & ipod, I wouldn't bother. You can pick up a Rio Karma for less than an ipod. They're not perfect but they support Vorbis and Flac, in addition to the usual mp3 and wma. There *have* been hard drive reliability problems, so I'd recommend buying it from somewhere which also supplies an extended warrenty.

      --
      -Yarn - Rio Karma: Excellent
  4. Thats Nice of Them by polyp2000 · · Score: 1

    Is this Chess game one that ships with OSX ? or is it an ancient forgotton version lost in the sands of its "pre-unix" days?

    nick ...

    --
    Electronic Music Made Using Linux http://soundcloud.com/polyp
    1. 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?

    2. 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. 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 Anonymous Coward · · Score: 0

      If roadmaps are anything to go by, I'm waiting for the PPC9900.

      10GHz plus. wowee

    2. 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:scary by System.out.println() · · Score: 1

      But with the source, you can make it so that it's possible to win. :-)

    4. Re:scary by Tumbleweed · · Score: 1

      Ohhh, I'm sure a G5 is too smart for _that_.

    5. Re:scary by DAldredge · · Score: 0

      I didn't know that the NEC Earth Simulator could play chess. :->

    6. Re:scary by jellomizer · · Score: 1

      I remember when I was taking AI in college and we had to make a game that it good enough to win sometimes. Well while I was programming it all the code looked good except for I did a < where I should have done a > Needless to say the program tried its hardest to loose. Even with me trying to loose it found a better way to loose then I did.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    7. Re:scary by Anonymous Coward · · Score: 0

      Not only does it play chess. It can predict the effects of an earthquake on your game.

  6. Windowless Chess by lullabud · · Score: 1

    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.

    1. 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
  7. The Licensce by polyp2000 · · Score: 0, Informative

    This is the source code for Apple's Chess.app Version 2.0, as shipped
    in MacOS X 10.3 "Panther". This project consists of two components:
    The Chess engine, "sjeng", and the graphical frontend.

    "sjeng", contained in the "sjeng" subdirectory, is distributed under the
    terms of the GNU General Public License. See sjeng/COPYING for
    details.

    The graphical frontend, i.e., all files not in the "sjeng"
    subdirectory (including files derived from glChess which Apple has
    permission to relicense under the following terms), are distributed
    under the terms of the Apple Sample Code License:

    IMPORTANT: This Apple software is supplied to you by Apple Computer,
    Inc. ("Apple") in consideration of your agreement to the following
    terms, and your use, installation, modification or redistribution of
    this Apple software constitutes acceptance of these terms. If you do
    not agree with these terms, please do not use, install, modify or
    redistribute this Apple software.

    In consideration of your agreement to abide by the following terms,
    and subject to these terms, Apple grants you a personal, non-exclusive
    license, under Apple's copyrights in this original Apple software (the
    "Apple Software"), to use, reproduce, modify and redistribute the
    Apple Software, with or without modifications, in source and/or binary
    forms; provided that if you redistribute the Apple Software in its
    entirety and without modifications, you must retain this notice and
    the following text and disclaimers in all such redistributions of the
    Apple Software. Neither the name, trademarks, service marks or logos
    of Apple Computer, Inc. may be used to endorse or promote products
    derived from the Apple Software without specific prior written
    permission from Apple. Except as expressly stated in this notice, no
    other rights or licenses, express or implied, are granted by Apple
    herein, including but not limited to any patent rights that may be
    infringed by your derivative works or by other works in which the
    Apple Software may be incorporated.

    The Apple Software is provided by Apple on an "AS IS" basis. APPLE
    MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
    THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND
    FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
    USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.

    IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
    INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
    REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE,
    HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
    NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    --
    Electronic Music Made Using Linux http://soundcloud.com/polyp
    1. Re:The Licensce by Anonymous Coward · · Score: 0

      how, exactly, does reprinting the license add to the discussion? If I wanted to see the license, I'd download the tarball and locate the file LICENSE.

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

  9. Re:yeah by Anonymous Coward · · Score: 0

    You're telling him to get a life... while you're the one who dug back into the archives to cross-reference a cut-n-paste troll?

    Nice.

  10. Changes in "Chess" since 10.3 Beta by Anonymous Coward · · Score: 0

    Does anyone remember that when 10.3 was in Beta, some people mentioned that it was possible to play the Chess game windowless, with a transparent background?

    This functionality didn't seem to make it to the Chess.app in the final 10.3... Can anyone restore it?

  11. Re:Battery problem? by leperkuhn · · Score: 1, Offtopic

    Sarcasm noted.. but you can get your iPod battery replaced for like $50. The fish was THIS BIG!

    --
    http://www.rustyrazorblade.com
  12. two players? by Anonymous Coward · · Score: 0

    i have a question.
    can you play against a friend?
    my iBook creams me.

    1. Re:two players? by ihatewinXP · · Score: 1

      I agree, it is an odd choice for Apple to start a new game on clicking chess.app without giving you the explicit choice of what to do but that said all you have to do is hit Apple+N at launch and it will give you the option of setting up the game.

      I hate to say it but if you couldn't be bothered to figure that out on your own you might want to try checkers ;)

      --
      ---- The real Slashdot is still here. You just have to browse at -1 to read the comments.
  13. Finally... by Anonymous Coward · · Score: 0

    I'll be able to win against the computer by making it stupider than myself. Bwahahahahahaha....

  14. 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.
  15. 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 Anonymous Coward · · Score: 0
      "Any pointers? :)"



      here's one: void*



      hope that helped...

    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
    3. Re:Transparent window? by CODiNE · · Score: 1

      Thx, the debug thing didn't work for me either. Maybe I'll play with it some more and see if I can get the hidden window large enough to not cut off the corner when the board is diagonally positioned. :)

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

  16. Online!!! by Anonymous Coward · · Score: 0

    if someone would make this network multiplayer then youd have something!!!! Rendezvous... and the floating board idea is awesome , a big second form me on that...

    1. Re:Online!!! by g-doo · · Score: 1

      Ooo...I like this idea. Another idea: how about a Windows port (interface and all)?

  17. winboard/xboard by bowronch · · Score: 1

    If you are interested in this, you might be also interested in Xboard/Winboard by Tim Mann... They are open source interfaces to text based chess engines... This allows you to write a chess program using text interface and use winboard for your GUI... lets you focus on the fun stuff like bitboards and hashtables...

    the link for xboard/winboard can be found here

    And as a shameless plug you might be interestd in checking out my chess engine (BCE) that can be run under xboard that can be found here

    --
    My Stuff: pspChess and foobar2000 plugins
  18. OMG! by ophix · · Score: 1

    to anyone who hasnt checked this out, do so.

    it sounds a lot better than i would have thought at the bitrate it is at. this is insane.

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

    1. Re:Transparent Window Hack by TomorrowPlusX · · Score: 1

      Funny. The set command didn't stick for me so I had to do the commenting-out trick.

      --

      lorem ipsum, dolor sit amet
    2. Re:Transparent Window Hack by pldms · · Score: 1

      It works with export MBC_DEBUG=16 for me. No code change required.

      --
      Slashdot looked deep within my soul and assigned
      me a number based on the order in which I joined
    3. Re:Transparent Window Hack by kuwan · · Score: 1

      Make sure that you open the Chess application from Terminal.app. You can't set the environment variable and then double click on Chess.app, you need to issue the "open /Applications/Chess.app/" command from the Terminal to do it.

    4. Re:Transparent Window Hack by System.out.println() · · Score: 1

      I did that and I don't see the menu option.... but I don't especially care, so thats ok :)

  20. 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.
    1. Re:cheaters cheaters.. by arcanumas · · Score: 1

      How it cheats?
      I don't think it is possible for a chess program to cheat.
      Games cheat in many ways, one of which is knowing what the user is doing (e.g if you have a lot of money then your opponent gets a lot of money)
      But how can a chess program cheat? It can't.

      --
      Slashdot Sig. version 0.1alpha. Use at your own risk.
    2. Re:cheaters cheaters.. by Ayaress · · Score: 1

      I've seen chess programs that could move pawns in illegal ways (capturing forward, moving diagonally without capturing), as well as the unique ability to make their rooks, bishops, and queens jump over other pieces. And it wasn't from bugs in the logic, because the player couldn't move pieces illegally.

    3. Re:cheaters cheaters.. by arcanumas · · Score: 1

      But that's not chess is it?
      Chess has specific rules that a proper chess program has to follow.
      Assuming that it DOES follow the rules, there is no way to cheat so as to win.

      --
      Slashdot Sig. version 0.1alpha. Use at your own risk.
  21. Maybe I can fit 1000 songs on a 128MB MP3 player! by Johnny+Mozzarella · · Score: 1

    Seriously, those tracks sound amazing for that bitrate. That's real news!

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

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

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

    2. Re:GNU Chess by bo-eric · · Score: 1

      Sure, but as it is stated on the "Old Sjeng (free)", the GPL:ed version is a lot weaker than Deep Sjeng. Presumably, Crafty is stronger than FreeSjeng.

      --

      -- Free speech is only free if your time is worth nothing.
  25. hahahahhaa by System.out.println() · · Score: 1

    if there were any mod points still being spent in tis thread i'd recommend you get +5 Funny :)

    That's classic.