Electrolysis...

  • Neospector
    13th Mar 2011 Member 0 Permalink
    http://pastebin.com/tbhSpTTN
    That is the current electrolysis code for IRON...
    http://pastebin.com/eW3vAgKb
    That is my edited code, to incorporate hydrogen.
    For some reason the latter code only produces hydrogen, no oxygen. How would I make it produce both?
  • jacksonmj
    13th Mar 2011 Developer 0 Permalink
    Choose either O2 or HYDR at random.

    Currently, you're changing the type of a single particle twice - first to O2, then to HYDR.
  • Neospector
    13th Mar 2011 Member 0 Permalink
    @jacksonmj
    And how would I do that?
  • jacksonmj
    13th Mar 2011 Developer 0 Permalink
    I suggest the following code, which should generate twice as much hydrogen as oxygen:

    if (2>rand()%3)
      part_change_type(r>>8,x+rx,y+ry,PT_HYDR);
    else
      part_change_type(r>>8,x+rx,y+ry,PT_O2);
  • Neospector
    13th Mar 2011 Member 0 Permalink
    "Some Unicode characters in this file could not be saved in the current codepage. Do you want to resave as Unicode in order to maintain your data?"