Sort of an idea, but mostly... Coding Help! O:

Got an idea? Share it here!

Moderators: Mystic Dragon, Xalia, Shard

Post Reply
User avatar
Unyko
Dragon
Posts: 1629
Joined: Sat Jan 28, 2006 5:01 pm
Contact:

Sort of an idea, but mostly... Coding Help! O:

Post by Unyko »

Alright, here's the idea part. XD I want to make a translater/generator for genetics. I have a list of said genetics, and what they refer to, but I'm not sure how to go about coding the thing so that you enter in your genes and it gives you the appropriate (and understandable) phenotype. >.>

I've found a morse code translator that I thought would work as a base and started modifying it, only to realize that would just spit out the basics (entering in 'rrbbyy, Bb*ee, Ff*, Hh, Bb*ll, Aa, nn, Ss, BbWW' you'd get something like 'white, glowing blue round eyes, glowing blue scales, white feathered mane, white feathered ridge, white feather tufted tail, light blue fairy wings' and that only barely makes more sense than the actual genes XD), but I want it to make things a little easier to understand than that. Like.. a real sentence. XD ('Your dragon has a white base color, with round glowing blue eyes, and glowing blue scales. It has a white feathered mane, a white feathered ridge and a white feather tufted tail. Its fairy wings are light blue.') I mean, I see how it -might- be done (type out the sentence as a default and have the translator fill in the blanks) but I don't know how to do it. ;.;

Then maybe (if I'm feeling particularly ambitious) I can make a generator so people can enter in their dragon's genetics and the one they intend to breed with and get the potential offspring's genetics/phenotype. O: But yeah. That's for another time. Maybe XD

So... anyone with coding experience who might know how to do something like this? *timid* Alternately, has anyone ever done something like this for their own genetics critters? o.o
.
Image... Image ... Image

_________________
User avatar
Dray
Dracolich
Posts: 9386
Joined: Wed Jul 06, 2005 11:16 am

Re: Sort of an idea, but mostly... Coding Help! O:

Post by Dray »

If you want the basic (yet possibly confusing) code that I've been using for my BWR things, I uploaded one of the more recent versions here. Not sure if that will help, but if nothing else, you can cut out everything in the middle and start over from the ground up?

eta: What is going on in the code is that I'm adding a bit of information for the parents, grandparents, and great grandparents for each section, as well as including an opportunity for each generation's clutch-mate's info to come up. The repetition of names is used to make parents' traits the most common, and great-grandparents the least common. It's pretty time-consuming to create, unfortunately, but with each generation I only have to add the new parent/grandparents/greatgrandparents set and delete the new great-greats from the side I already have documented... I'm sure there's a faster way, but I'm not familiar enough with coding to make one!
User avatar
Starburst
Ancient Dragon
Posts: 2189
Joined: Mon Jul 11, 2005 7:33 pm
Location: Spreadsheet Heck

Re: Sort of an idea, but mostly... Coding Help! O:

Post by Starburst »

A tad bit off-topic but I was playing with that generator and got this
Name: tasiyo Filidechiroptidae
Gender: Male
Base: Black
Pattern: Rainbow Mottling
Skin: Pink (Fleshy)
Extra: Same as Base
Eyes: Black
Accents: Same as Base
Size: Medium-Small (9' tall at shoulder)
Abilities: Psionics (Telepathy, Telekinesis), Human-Dragon Spectrum Shifting, Verbal Speech, Telepathy, Healing Illnesses with Radioactive Causes, Vocal Speech, Verbal Speech
Personality: Crazy, Trickster, Childish
Bond: no
...and I want it. XD

To stay on topic, I do know how to code a very basic generator to give random genotypes, and if you have the parents' genotypes it is very easy to create one that gives you offspring based on the parents (male allele + female allele randomized pairs for each spot of genetic code). I have one for the Asana, I just edit it up for every bred clutch I do.
Molly
Meridian Weyr | Caer Nova | Perigee Castle | Starfall Dragonry
User avatar
Dray
Dracolich
Posts: 9386
Joined: Wed Jul 06, 2005 11:16 am

Re: Sort of an idea, but mostly... Coding Help! O:

Post by Dray »

Starburst, that's why I usually wind up making about 30 dragons and then paring them down to the appropriate clutch sizes... XD There are too many awesome combos!
User avatar
StarFyre
Ancient Dragon
Posts: 3246
Joined: Wed Jul 06, 2005 10:44 am
Location: Middle of Nowhere
Contact:

Re: Sort of an idea, but mostly... Coding Help! O:

Post by StarFyre »

So, I'm not entirely sure how readable this is, seeing as it actually turned out to be more complicated in implementation -- in that I'm using regex (which is difficult to understand on a good day) and nested for-loops to the extent that my teachers would hit me -- than I initially thought, but here's an example of a "straightforward" translation of genetics to human words based on Starburst's Asana (because I had those to-hand =P Thank you, Star, for making something easy enough to implement that was clearly defined in a place I could find it). Adding more than one genetic structure to it starts to change the game a bit, and if you can point me towards a fully realized and understandable set of genetics to use, I'll make a second example so you can see how having multiple genetic codes would interact.

As for being able to crossbreed distinct species based on genetics...

I had a few thoughts in that regard, but it becomes really complicated after a bit, depending on what you want to do. Do you want to take two different species and output a genetic code for the offspring, because at that point we're going to have to talk about the Nexus Genetics project that we keep coming back to. Or do you want to be able to take two species, one or both of which may have a genetic code, and output a human-readable "code" to color by?

Of course, there are even ways to get around the need for the Nexus Genetics - ex: in the case of a dragon with genetic codes X a dragon without, translate the dragon-without into an approximate of the dragon-with's code then mix, keeping in mind the extras of the dragon-without to add back in or not based on a secondary "Addendum" set of genetics that define whether the offspring keeps momma's trait for tail or daddy's trait for tail (ad nauseam for each trait you need to define)). This becomes complicated as well, but it's doable. ...

Back to the genetics-to-human-readable concept: my next action is going to be to map the breakdown of the logic paths so you can see how my brain took the problem and turned it into a programming project. Because while staring at code may be helpful to some people, the logic paths are often more informative.

Genetics! http://silveredmagic.com/gens/genetics.html

Edit to avoid double posting: images of layout logic! Be warned, these are rather large since I always do planning on a white-board, as it helps me think.

Layout of the genetics and theory on how to deal with them: http://www.silveredmagic.com/images/pro ... netics.png
English version of the steps the program needs to take: http://www.silveredmagic.com/images/process/process.png
Thoughts on the details, directly follow the arrows from the above image: http://www.silveredmagic.com/images/pro ... ansion.png

Next on the list of things to do: expand the meat of the program for your edification. Fun times!
User avatar
Yakima
Ancient Dragon
Posts: 3824
Joined: Wed Jul 06, 2005 12:17 pm
Location: Minnesota, USA
Contact:

Re: Sort of an idea, but mostly... Coding Help! O:

Post by Yakima »

I'm no the only one who's genetic crazy still? *dances* good. :P
~ Weyrwoman Yakima of Isla Weyr

Isla Weyr: http://www.isla.mage-circle.com
Velare Isle: http://www.velare.mage-circle.com
Treval Dragonry: http://www.treval.mage-circle.com
Alair WolfKeep
The Last Oddessy: http://www.last-oddessy.mage-circle.com
Baskar Castle: http://www.baskar.mage-circle.com
World of Sentra: http://www.sentra.mage-circle.com
User avatar
Starburst
Ancient Dragon
Posts: 2189
Joined: Mon Jul 11, 2005 7:33 pm
Location: Spreadsheet Heck

Re: Sort of an idea, but mostly... Coding Help! O:

Post by Starburst »

@ Yakima - I've been genetic-crazy probably since I was about 12 years old and figured out how to punnet-square genetic codes. X3 Back then it was cyber cats, but I love how we've brought it into dragoning now!

@ Star - Oh wow, I really adore that generator idea! I might actually end up using it myself when it's completed just to make sure I don't read my own codes wrong >___> -dodges tomatoes-
Molly
Meridian Weyr | Caer Nova | Perigee Castle | Starfall Dragonry
User avatar
StarFyre
Ancient Dragon
Posts: 3246
Joined: Wed Jul 06, 2005 10:44 am
Location: Middle of Nowhere
Contact:

Re: Sort of an idea, but mostly... Coding Help! O:

Post by StarFyre »

Hahaha, good job Star =P Well, the translation of one set of code works perfectly at the moment, unless you've noticed something while playing with it that I didn't. I'm mostly considering how I should implement the second half (cross breeding inside one species) atm. I'm considering the option of spitting out all possible results (removing duplicates except to note percentages) as the most viable concept. We'll see.
Post Reply