Jump to content

Cellular Automata Help

- - - - -

  • Please log in to reply
4 replies to this topic

#1
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
I want to make a simulation similar to Conway's Game of Life with my own rules. The problem is that i have never coded any image processing software. I was thinking to use JButtons as the box , but i think that will be too heavy , so any good ideas on how i can do that?

#2
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
This really does necessitate a custom widget. I'd suggest you learn about painting with the Swing API. There isn't really any usable J-Widget for this, with the possible exception of JTable with seriously custom TableModel and TableCellRenderer subclasses. I wouldn't know how to do that with this widget though.
Wow I changed my sig!

#3
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
Cool game idea.
I might give this a go.

I'd create a class that represents my grid. My grid would be contained inside of a 2-dimensional boolean array.
After this, instead of using JButtons, I'd custom paint over JPanel.

An example might help though:
Creating the Demo Application (Step 3) (The Java™ Tutorials > Creating a GUI With JFC/Swing > Performing Custom Painting)

#4
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
well , aren't there any cellular automation tools in which you just define the rules and then rest of the work is done by the application?

#5
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
Have you tried sourceforge?

SourceForge.net: Software Search[]=trove%3A198

You can most likely extend some of the frameworks people have created.

Edited by lethalwire, 01 April 2011 - 02:33 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users