Porting Minesweeper to OSX advice

bighairydog

tail-wagging member
Hello programming gurus,

I'd like to learn how to program, as HTML/PHP/JavaScript has gotten way too softcore for me. Therefore, I have decided to port to OSX the best (read only) reason to own a PC - Minesweeper! (BTW, I'm aware that this has already been done, but I want to make mine better, and freeware)

I'm already competent in basic programming concepts, but am scared by 'real' programming languages that require all sorts of things like declaring variable types and sizes before use.

What language should I use? I like the idea of using cocoa, because it's part of the Mac community, and I hear it makes it easy to add cool features, but is it too advanced for a relative newbie? How about Java, C, C++, ObjC, Applescript? I'm lost for chioce!

I'm looking for a language that:
  • is easy to pick up
  • is good for programming games
  • makes adding multimedia bits (images, video clips sound etc...) easy
  • has a sensible way of dealing with realtime user input
What would you reccommend? And if you know a good book to learn from, that would be god too. any Help much appreciated.

Ta

Bernie :eek:)
 
You might be able to do it in AppleScript Studio which is part of the Developer Tools.

simX will have to help you with that, though. He's the ASS Expert :D
 
Assembly programming is definitely the way to go. ;)

No dealing with data types, variable declarations, what have you. Just pure programming...



Seriously, I am not familiar with ObjC, so I don't know what data types are available. Java has pretty good predefined data types (lists, stacks, what have you). I'd probably avoid C/C++ as a beginner's language, personally, since you'd have to build just about everything form the ground up. Unless, of course, there are libraries already available for OS X.

You might even want to try this in Perl or something similar. Perl has GUI capabilities, and has a lot of built-in functionality. It might not be the fastest thing in the world, but it would get you started.

So essentially my advice is this: Find a language where a lot of basic things are built in. Not only does this mean you don't have to reinvent the wheel, but the built in things are frequently going to be more thoroughly tested and optimized than user-defined things. To this end, ObjC might work (I've never even seen ObjC code), Java would work, higher level scripting languages (Perl, Python (I personally don't like Python)) may work...
 
Cheers for the help.

Applescript sounds like the best bet for a simple game, but I'm worried it may limit the scope of transferrable skills I get from a project. Any AppleScript evangelists beg to differ?

Someday though, I'd really like to learn Java, so I wonder if it's best to jump in at the deep end and learn it now. Everybody loves a Java enabled programmer...

Bernie :eek:)
 
I would not suggest AppleScript Studio as the way to go for games. I would recommend Obj-C. AppleScript is limited in multimedia tasks – although it is possible if you really want to take a stab at it.

Obj-C is not an easy language to learn, nor is AppleScript (if you haven't had previous experience from the Classic Mac OS days). But both are powerful languages, and it always depends on what you're going to program. Like I said, Obj-C would probably be better for the Minesweeper game that you want to program.

To tell you the truth, though, I'm really annoyed at how slow AppleScript Studio and am seriously considering migrating to Obj-C. I'll still need to learn it, so I'll probably keep developing MUG in AppleScript Studio for a while until I can replace all the features in Obj-C.

The place where AppleScript really shines is in doing things in multiple applications. Of course, all of the applications must be scriptable – but it's always nice to be able to do stuff in FileMaker and be able to transfer all the data over to another scriptable application like Mail.app or something.


OK, I went off on a couple of tangents. So to sum it all up, I would recommend Obj-C for your project, and I'm sure there are many people here that would love to help you -- gplex, ksuther, JoeSpiros, etc.
 
good idea! (to port mine sweeper to os x)
i'm not a programming guru, but if u make it open source (e.g. on source forge) i'll help u...

just let me know...
 
OK, cheers for your help guys - after a bit of rooting round the apple website I've settled on Java-Cocoa. That way I'll have more transferable skills, but can still use all the ObjC multimedia classes.

It also strikes me that all the languages I looked at are essentially just like scripting languages, just more complex. I always thought that real programming languages would be like INTERCAL, where the variables are really hard to get to grips with (only takes 2 data types, 16 bit and 32 bit). Take this quote from the INTERCAL Manual for example.
...so the fastest way to assign the value '65536' to a variable would be
Code:
DO :1 <- #0$#256
...

One of the big changes to C that Stroustroup made when he created C++ was the use of constant data types, which kept the programmer from inadvertently changing the values of variables which shouldn't. The creators of INTERCAL recognised the need for this way before Stroustroup became Mr. Fancy Pants and so they put the IGNORE statement into the language. Any variables or arrays named in a list following the DO IGNORE directive will effectively become read-only. Their value can be used in operations and assigned to other variables, but any attempt to assign a value to a variable being IGNOREd will be met with a contempt so profound that the compiler will pass over it in utter silence. Of course, there may be a time when you want to cast away the constancy of variable, and in that case, you would use the REMEMBER directive. Any variable which is REMEMBERed will stay so until it is IGNORED. To make IGNORE-ing more permanant, the SNUB directive is provided. When used upon a variable will cause it to IGNORE any attempts to write to it, even if it is REMEMBERed. The only way to make a SNUBbed variable writeable again is through the use of the APOLOGIZE statement which has a fifty percent chance of working.

The following code takes the value of a .1# 16 bit data type and converts it to a .1# variable, printing the result. The requirement for 28 lines of code, compared to 3 in C++ offers clear advantages to the programmer in terms of excuse opportunities for the playing of quake.

Code:
        DO (5) NEXT
    (5) DO FORGET #1
        PLEASE WRITE IN :1
        DO .1 <- 'V -":1~'#32768c /#0'"c /#1'~#3
        DO (1) NEXT
        DO :1 <- "'V -":1~'#65535c /#0'"c /#65535'
                ~'#0c /#65535'"c /"'V -":1~'#0c /#65535'"
                c /#65535'~'#0c /#65535'"
        DO :2 <- #1
        PLEASE DO (4) NEXT
    (4) DO FORGET #1
        DO .1 <- "V -':1~:2'c /#1"~#3
        DO :1 <- "'V -":1~'#65535c /#0'"c /":2~'#65535
                c /#0'"'~'#0c /#65535'"c /"'V -":1~'#0
                c /#65535'"c /":2~'#65535c /#0'"'~'#0c /#65535'"
        DO (1) NEXT
        DO :2 <- ":2~'#0c /#65535'"
                c /"'":2~'#65535c /#0'"c /#0'~'#32767c /#1'"
        DO (4) NEXT
    (2) DO RESUME .1
    (1) PLEASE DO (2) NEXT
        PLEASE FORGET #1
        DO READ OUT :1
        PLEASE DO .1 <- 'V -"':1~:1'~#1"c /#1'~#3
        DO (3) NEXT
        PLEASE DO (5) NEXT
    (3) DO (2) NEXT
        PLEASE GIVE UP

As you can see, I had cause to be pleased when I saw that Java was so like the PHP I know and love...

I'll post the game when I get it together.

Bernie :eek:)
 
Good choice with cocoa. If your wanting to get into it I'd suggest getting the book Cocoa Programming for Mac OS X by Aaron Hillegas. It is a very good book, and I'm learning form it right now.

Simx: you want to have a nice MUG of cocoa? :p
 
Doesn't that deal with use of ObjC, not Java?

I've found it hard finding Java specific cocoa resources, because everybody assumes you'll be using ObjC for coding. There's a good tutorial on the apple developer site though.

Bernie :eek:)
 
Ahh, you want to do cocoa with Java? I personally wouldn't recommed it, since its kind of a hack. Cocoa has a layer called the Java bridge that basically converts java code into objective-c. Also, cocoa is natively objective-c so it might be easier in the long run to do it with objective-c. But if you don't want to deal with objc go ahead! :).
 
I don't recommend using Java in Cocoa. It's not nearly as powerful as Objective-C is, but slightly more than ASS :)

A minesweeper game shouldn't be too hard to make, just have to subclass a view handle it's clicks and draw it and make a basic engine, blah blah blah blah blah :)

You might want to pick up Aaron Hilegasses Cocoa book, but it's not necessary. cocoadev.com and cocoadevcentral.com are good ways to learn cocoa, especially cocoadevcentral for newbies.
 
Yeah, I hear Java isn't as fast as compiled languages, but it has the advantage of portability. If you know Java then you can create web Applets and Applications that run on any platform; there's just more uses for Java. I might learn ObjC next though, because the sample code I've seen looks similar, so it shouldn't be hard.

Besides, I've played simple games written in ObjC, and they're disconcertingly fast - A bit of latency to user responses is essential for relaxed gaming ;o)

Bernie :eek:)
 
Any java apps you create with cocoa will not be portable. They will be OS X only. If you create an app with just straight java and don't use any cocoa stuff it will be portable, but it wont be cocoa :p
 
Originally posted by googolplex
Simx: you want to have a nice MUG of cocoa? :p

My NAME is simX. Please respect MY capitalization. :rolleyes:

Anyway, YEAH, a nice MUG of cocoa SOUNDS good right NOW. :p ;) :D
 
*sigh* Sorry about this.. really tired and accidentally responded instead of editing.
 
I'd like to see that game freewqrae... /me recalls losing many hours to that old game when he was a slave of the windows world.....
 
Originally posted by googolplex
Any java apps you create with cocoa will not be portable. They will be OS X only. If you create an app with just straight java and don't use any cocoa stuff it will be portable, but it wont be cocoa :p
True, but in the process of learning how to code Java-cocoa apps, I will learn how to make pure Java apps.

Also, what you said isn't strictly true - I assume it's possible to confine all calls to cocoa wrapper classes into a seperate class, and conditionally use that when the app is running on OSX, as opposed to native Java UI calls on other systems. That way might be a bit backwards, but at least you can let the non-enlightened use the app, allbeit without flashy cocoa interface.

Bernie :eek:)
 
hey sImX :D

bighairydog, do what you wish. Java is a good language and if your learning it so you know cocoa and pure java then thats cool. Tell us when you come up with something! :)
 
Originally posted by macguy17
I'd like to see that game freewqrae... /me recalls losing many hours to that old game when he was a slave of the windows world.....
Of course... I love freewqrae games as much as the next guy ;o) And you can guess what site's members will be the first to be offered it.

Bernie :eek:)
 
Back
Top