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:
      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.
structity struct mcstruct-sauce! Also, why Strings for numeric data?
elfprince13 wrote:
structity struct mcstruct-sauce!
Um, yes?
ibid. wrote:
Also, why Strings for numeric data?
Because the data I use isn't strictly numeric. For example, the weight for Helium is "4.002602(2)", and the melting point is "n/a". It was quicker for me to just make it a string rather than change all the data to be actual numbers. Since it's strictly output (at least for now) it seemed like the best thing to do.
Wow, a lot of this is beyond me :<

Goodluck though!
Are you going to have people be able to go up/down/left/right in the program on the Prizm?
Yes, that's the point. This was just to prototype it out.
What an awesome idea! I vote for 64x64 px icons representing each element as well, to take advantage of that spiffy color screen. Although that's 983KB for the lot. Sad
Yeah, the graphics will probably be the last part, since I'm not so good at art Sad
merthsoft wrote:
Yeah, the graphics will probably be the last part, since I'm not so good at art Sad
You're good at music, which is an art! But I was thinking more little thumbnailed photographs, like a bar of gold, a helium balloon, an oxygen tank, etc. As you say, that's a last step. Are you envisioning the selection screen being a graphical periodic table, or a list?
merthsoft wrote:
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.
Graphical. It'll start out as just a list as I get everything in place, though.
KermMartian wrote:
merthsoft wrote:
Yeah, the graphics will probably be the last part, since I'm not so good at art Sad
You're good at music, which is an art! But I was thinking more little thumbnailed photographs, like a bar of gold, a helium balloon, an oxygen tank, etc. As you say, that's a last step. Are you envisioning the selection screen being a graphical periodic table, or a list?


Why not have a representation of the nucleus (of a standard isotope) or the electron orbitals?
KermMartian wrote:
merthsoft wrote:
Yeah, the graphics will probably be the last part, since I'm not so good at art Sad
You're good at music, which is an art! But I was thinking more little thumbnailed photographs, like a bar of gold, a helium balloon, an oxygen tank, etc. As you say, that's a last step. Are you envisioning the selection screen being a graphical periodic table, or a list?


In fact, if you include a small picture bibliography as a .txt or similar file, you can rip some pictures from an online periodic picture or search them on Google images. As long as the image doesn't have special usage rules, you can use it with proper citation.
elfprince13 wrote:
KermMartian wrote:
merthsoft wrote:
Yeah, the graphics will probably be the last part, since I'm not so good at art Sad
You're good at music, which is an art! But I was thinking more little thumbnailed photographs, like a bar of gold, a helium balloon, an oxygen tank, etc. As you say, that's a last step. Are you envisioning the selection screen being a graphical periodic table, or a list?


Why not have a representation of the nucleus (of a standard isotope) or the electron orbitals?
Ooh, I like this idea. You should make me some pictures Wink
I like that a lot too! If you don't make all the pictures, you should at least write a PHP + GD2 script that will generate them. Smile
What is PHP + GD2, and why would I use it to generate the images?
merthsoft wrote:
What is PHP + GD2, and why would I use it to generate the images?
GD2 is a library of PHP functions that makes it trivially easy to generate images and export them in the usual image formats. Although now that I'm thinking about it, for the sake of space, it makes much more sense for you to have a routine in your program that will generate the orbital images on the fly, perhaps...?
Yeah, that might be better. Though I'm still not sure why I'd use PHP to generate images in the first place. Seems I could just use C#, which comes with a functions that make it trivially easy to generate images and export them in usual image formats Wink.

Oh, and I made progress last night! With the help of benryves I got the C code generated to create the array and set up the structs and everything. I'd post the code but it's pretty big Smile. I do need to make a couple change. I was being lazy in my C# implementation and starting my arrays at 1, so I'm going to have to subtract 1 from everything to make it work right when I generate it. I figure if I subtract one at that level, I don't have to worry about it at the next.

What's holding me up the most at this point is that I haven't done any C since my last Prizm project, and I haven't done anything extensive since I wrote that OS in school, so there's the language barrier for now.
merthsoft wrote:
Ooh, I like this idea. You should make me some pictures Wink


It's been more 5 years since I've had any formal chemistry. I could probably calculate the orbitals from physical principles in a pinch, but I don't have them memorized by any means.

[edit]

Nor the number of neutrons for the "standard" isotopes. There's a formula (or system of equations) for that too, if I remember correctly, but I only studied nuclear physics for a couple of days last year in the midst of some other stuff, so that isn't fresh either.
I have faith in you on that, Elfprince. Wink

Quote:
Yeah, that might be better. Though I'm still not sure why I'd use PHP to generate images in the first place. Seems I could just use C#, which comes with a functions that make it trivially easy to generate images and export them in usual image formats Wink.
Because that's what I'm used to and can prototype quickly. It's not a great language to be familiar with image functions in, probably; I could probably hold my head higher as a nerd and geek if I was fluent in throwing quick image scripts together in Python, for instance, but over the years I've developed a lot of experience generating images from PHP.
KermMartian wrote:
if I was fluent in throwing quick image scripts together in Python, for instance,

PIL is really weird. It's pretty powerful too, but weird. GD2 supports other languages than just PHP though, fwiw (including Python and C).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page 1, 2, 3, 4, 5  Next
» View previous topic :: View next topic  
Page 1 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement