00:00
00:00
gnome42
What is this.. I don't even use it.

Age 31, Male

Student

USA

Joined on 12/5/07

Level:
11
Exp Points:
1,160 / 1,350
Exp Rank:
56,355
Vote Power:
5.29 votes
Rank:
Safety Patrol
Global Rank:
25,970
Blams:
72
Saves:
307
B/P Bonus:
6%
Whistle:
Normal
Medals:
348

java is a bitch to work with.

Posted by gnome42 - December 6th, 2008


a couple days ago i started thinking about conway's game of life, and how i had played the flash version here a while back, and i decided to make the java version using the gridworld interface.
its tough as shit to work on.
because java doesnt operate on "ticks" like conway's game does. "ticks" ar steps in which everything happens simultaneously. in java, everything happens starting from the top-left corner. ive gotten almost all the coding done, its just annoying as hell trying to accomodate for that bug. in game-maker language theres a "before step" , a "step" and an "after step" which sounds really helpful right now.. which also inspires me to make the game in that also.
too bad my actionscripting in Flash is utter shit.

EDIT.....
I finally finished programming Conway's Game of Life in the GridWorld interface of Java...jre 1.5.0

I don't think I really did it properly though, but its the best way I could think of. There are 4 classes.
Block class--counts how many Cells are adjacent to it
Cell class, extends Block--this class, well.. yeah. It's the living cell.
Tile class, extends Block--which... is the tile
Aging class, extends Block also--ill explain...

Since in Conway's game everything is supposed to happen simultaneously, and GridWorld's sequence goes from top left to bottom right, I had to make it so that in the middle of the step, the new cells (which were created in the middle of the "tick") would still be counted as Tiles by the lower objects, and that the newly created Tiles (Cells that died in the middle of the "tick") would still be counted as living Cells.
I just assigned a boolean value to each new instance created, saying whether it had been created in that step or not. But I also had to make this mid-feature last only until the end of the step. Naturally, I thought of tons of ways to do this, but I'm not too familiar with the GridWorld interface... so I couldn't do any of them. After a bit more of thought, i finally decided to make a new Object that would reset the boolean at the end of the step.
I wasn't sure what to make it though, whether to make it a ControlCell that also transforms into a ControlTile, or to just make a random object. I felt like there could be alot that could go wrong if someone accidentally deleted the controlling tile/cell, so I eventually decided to make the random Block, the one called Aging. The restriction is that it must be in the bottom-right corner. It simply resets the boolean of every object in the class...

...so... yeah. It works...
Yeah, reading over this I feel like a nerd or something, but I guess I am since I just programmed Java for fun. And wrote about it using correct grammer, spelling, and punctuation (or did I?).
Whoopee. I'm a loser. But at least i have the "Glider Gun" to amuse me... hehe.


Comments

Dude scripting is so hard, it makes my brain hurt.

the hard part is getting it to work. theres always something youve forgotten to do, and then you realize that you dont know how to accomplish it. it does suck. but for some reason i still like it. strange..

asdf

qwerty

Stop spamming my page or I will be forced to ban you.

oh dear.

I wouldn't ban you. But it's not fair if you keep doing that. I want to earn comments in a fair and honourable way.

Also, Sk8ergril still has much more then me.

......