Help with Miners4K

Hi everyone…

first of all, I am not as good as you are in programming… so totally newbie…

I discovered the source code of miners4k, and since I understand some of it, would like to play around with it and modify few things…

Can anyone tell me the exact steps from the a.java file (that i modified) till the html page where you can launch the game. (locally if possible) ?

Remember I’m a dummy, so clear step by step instruction would be very appreciated… Collection of links if they could do the same appreciated as well…

Thanks in advance

Good4u

As you say you have little experience, I’d advise you not to use 4K games as a base, because they are … well … non-OO, ‘bad’ design, hacked together and will only confuse you.

Disclaimer: I haven’t read the sourcecode of Miners4k, so I only have a gut-feeling about the OO/design, NOFI

You might be more interested in kevglass’ tutorials on cokeandcode.com

So you mean it’s just to hard to get hte a.java file into a local webpage, so that I can check my corrections ? Why is that ? I’m just so curious and excited about this game, would be fun if there would be a way to customize it to my own preferences… Since the file is very well commented, I don’t thinks that would be too hard… but it’s just that last bit that bothers me… I just can’t understand why there isn’t any easy way ? Thanks again for your support

You don’t need to run it from the web browser. Just run it from the command line like any other Java program. The way you are seeing it launched from the browser is called Java Web Start. If you search on that, you will learn how it works. It is an advanced topic, so you may find it confusing at first.

Dear CaptainJester,

thanks for that hint…

Now i’m try to launch a.java from the dos command line and get the following error:

D:\temp prog download\miner>java A.java
Exception in thread “main” java.lang.NoClassDefFoundError: A/java

Any ideas ?

compile it first…

javac A.java
java A

okay, first off, as the organizer of the 4K contest, let me tell you [as it was already stated]: it is a bad idea to for newbies to learn from 4K games!. we use many optimization tricks, such as one-letter variables, classes with only 1 method (main), etc. most 4K games code are unorganized, unstructured, unconventional, and borderline undreadable. but fortunately, some of the 4K codes are commented - like Miners4K. but still, that’s a doozy.

now, with that said. Miners4K is not an applet, so you cannot put it in a webpage. The only programs that can be put in a webpage are classes that extend Applet and implement the init() and paint() methods, to name a few.

as far as the Miners4K source goes, you should be able to compile it like so:


javac A.java

and execute it like so:


java A

if you want another 4K code goodie, you can hack around at my game, Goomba4K. It didn’t win the contest like Miners4K did, but hey - it’s another game to toy with. You can mess with it however you want. In fact, if you want to start a thread about a question about my code, that’d be fine too. :stuck_out_tongue:

Haha. For that reason I decided against making my source public. Sure there are a few nice things in it, but its buried under a pile of cryptic n ugly code.

Its pretty unlikely that someone will learn anything from 4k code. Its really the worst. Even very simple 4k games are hard to decypher.

Hi everyone,

first thanks for all your replies… and wise advices…

Looks like everything is fine now… I can start editing it… I’m delighted…

Thanks again !

Good4U.