phetsims / build-a-nucleus

"Build a Nucleus" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 5 forks source link

Assert that every entry in either DECAY_INFO_TABLE and HalfLifeConstants have an entry in the other. #164

Closed zepumph closed 1 year ago

zepumph commented 1 year ago

We should write an assertion that makes sure that these entries match. Even if they are null or -1 for "unknown".

zepumph commented 1 year ago
if ( assert ) {

  for ( const protonNumber in HalfLifeConstants ) {
    for ( const neutronNumber in HalfLifeConstants[ protonNumber ] ) {
      console.log( protonNumber, neutronNumber );
    }
  }
}
zepumph commented 1 year ago

I added the assertions above. @Luisav1 will you please help me understand why one has an entry for 0,0 HalfLifeConstants, but DECAYS_INFO_TABLE does not?

It meant that I needed to add this guard, but I would rather not need this. Can you take a look? Can we make this consistent?

https://github.com/phetsims/shred/blob/a4c68b87bbf71e1cc28e9cd24c2fe9446a1c53bb/js/AtomIdentifier.ts#L14243

zepumph commented 1 year ago

I added the assertions above. @Luisav1 will you please help me understand why one has an entry for 0,0 HalfLifeConstants, but DECAYS_INFO_TABLE does not?

What a can of worms I opened up here!!!?!?!! @Luisav1 and I will take care of this over in https://github.com/phetsims/build-a-nucleus/issues/169. Closing