- [Prizm] Periodic Table of the Elements
- 27 Sep 2011 07:46:15 pm
- Last edited by merthsoft on 04 Oct 2011 03:35:04 pm; edited 1 time in total
I've decided to make a periodic table of the elements for the Prizm. I believe this may already exist, but this is a program I've always wanted to make before, so I figured I might as well give it a try. I figured I'd start by prototyping some data structures in C#, since I can produce code much faster in it.
My first idea was a 2D linked-list of sorts, where each node holds an up, down, left, and right reference to other nodes. When you press "up" it goes to the "up" node, etc. Each node would also hold an X and Y coordinate for the cursor. This way I can drop a static image as the background, and draw the cursor on top of it based on the current node's place. Talking with my co-worker today, we realized it'd also be nice to have an array of all the elements, that way you can quickly jump to whatever element you want. Given that I already have the array, I decided the up, down, left, and right data can just be indexes into the array for the elements they point to. This means I can do initialization pretty lazily. I'm generating the structure from a CSV file of element data, so I can just store the up, down, left, and right numbers, and load them in. So, I ended up with this class:
Code:
And then I just do e.g. Current = ElementList[Current.Up]; to go up. Here's a screen shot of some test stuff:
The next step is to do this but on the Prizm.
My first idea was a 2D linked-list of sorts, where each node holds an up, down, left, and right reference to other nodes. When you press "up" it goes to the "up" node, etc. Each node would also hold an X and Y coordinate for the cursor. This way I can drop a static image as the background, and draw the cursor on top of it based on the current node's place. Talking with my co-worker today, we realized it'd also be nice to have an array of all the elements, that way you can quickly jump to whatever element you want. Given that I already have the array, I decided the up, down, left, and right data can just be indexes into the array for the elements they point to. This means I can do initialization pretty lazily. I'm generating the structure from a CSV file of element data, so I can just store the up, down, left, and right numbers, and load them in. So, I ended up with this class:
Code:
public class ElementNode {
public int AtomicNumber { get; set; }
public string Symbol { get; set; }
public string Name { get; set; }
public string Group { get; set; }
public string Period { get; set; }
public string Weight { get; set; }
public string Density { get; set; }
public string MeltingPoint { get; set; }
public string BoilingPoint { get; set; }
public string SpecificHeatCapacity { get; set; }
public string Electronegatvity { get; set; }
public string Abundence { get; set; }
public int Up { get; set; }
public int Down { get; set; }
public int Left { get; set; }
public int Right { get; set; }
public ElementNode() {
}
}
And then I just do e.g. Current = ElementList[Current.Up]; to go up. Here's a screen shot of some test stuff:
The next step is to do this but on the Prizm.