Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
OS X Businesses Operating Systems Programming Apple Entertainment Games IT Technology

Apple's Chess 2.0 Source Code Available 63

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).
This discussion has been archived. No new comments can be posted.

Apple's Chess 2.0 Source Code Available

Comments Filter:

  • I think it would be more interesting if someone somehow skinned the Woz for this.
    • 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 s
  • by ubiquitin ( 28396 ) * on Tuesday March 30, 2004 @12:44PM (#8715943) Homepage Journal
    The gentleman who wrote sjeng also wrote prototype Vorbis 1.0 encoder that can go down to bitrates of 4kbps [sjeng.org] that he claims can give a listenable stereo stream. IMHO that's bigger news than source to Chess.app 2.0.
  • 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 ...
  • scary (Score:5, Funny)

    by Tumbleweed ( 3706 ) * on Tuesday March 30, 2004 @12:46PM (#8715961)
    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...
    • Re:scary (Score:3, Funny)

      by tverbeek ( 457094 )
      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.

    • But with the source, you can make it so that it's possible to win. :-)
      • Ohhh, I'm sure a G5 is too smart for _that_.
      • 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.
    • I didn't know that the NEC Earth Simulator could play chess. :->
  • 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.
    • by Crash Culligan ( 227354 ) on Tuesday March 30, 2004 @02:42PM (#8717617) Journal
      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
    • Re:Windowless Chess (Score:3, Informative)

      by tim1724 ( 28482 ) *
      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.)
  • by javaxman ( 705658 ) on Tuesday March 30, 2004 @01:00PM (#8716203) Journal
    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 [apple.com].

    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?

  • Transparent window? (Score:5, Interesting)

    by CODiNE ( 27417 ) on Tuesday March 30, 2004 @02:50PM (#8717694) Homepage
    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? :)
    • by TomorrowPlusX ( 571956 ) on Tuesday March 30, 2004 @04:43PM (#8718974)
      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!
      • 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. :)
      • 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/C o nceptual/BPRuntimeConfig/Concepts/EnvironmentVars. html The bit at the bottom of the page on setting application-specific environment variables says something about "The second w
  • 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 [tim-mann.org]

    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 [bowron.us]

  • by kuwan ( 443684 ) on Tuesday March 30, 2004 @03:50PM (#8718400) Homepage
    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.
  • by seann ( 307009 ) <notaku@gmail.com> on Tuesday March 30, 2004 @04:06PM (#8718567) Homepage Journal
    Now we can find out how how it cheats.
    • 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.
      • 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.
        • 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.
  • Little Diagrams (Score:2, Interesting)

    by paulymer5 ( 765084 )
    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 validatio
  • by gklinger ( 571901 ) on Wednesday March 31, 2004 @01:34AM (#8722918)
    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.
  • GNU Chess (Score:2, Interesting)

    by ParryHotter ( 738618 )
    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?
    • Re:GNU Chess (Score:2, Informative)

      by Portfolio ( 552067 )
      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 [telia.com] 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

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

"Don't tell me I'm burning the candle at both ends -- tell me where to get more wax!!"

Working...