Ejemplo n.º 1
0
 public void AddAtom(Atom atom, int quantity = 1)
 {
     if (!this._atoms.Contains(atom))
     {
         this._atoms.Add(atom);
         this._atomQuantities.Add(quantity);
     }
     else
     {
         int index = this._atoms.IndexOf(atom);
         this._atomQuantities[index] += quantity;
     }
 }
Ejemplo n.º 2
0
        public void Show(Atom atom)
        {
            this._atomDescription.AlphaRate = 0;
            this._atomElectronegativityText.AlphaRate = 0;
            this._atomNameText.AlphaRate = 0;
            this._atomValenceText.AlphaRate = 0;
            this._background.AlphaRate = 0;

            this._atomDescription.Alpha = 1;
            this._atomElectronegativityText.Alpha = 1;
            this._atomNameText.Alpha = 1;
            this._atomValenceText.Alpha = 1;
            this._background.Alpha = 1;

            this._atomDescription.DisplayText = atom.Description;
            this._atomDescription.InsertNewLines((this._background.ScaleX * 2) - 45); // -45 to avoid touching the border

            this._atomElectronegativityText.DisplayText = string.Format("E: {0}", atom.Electronegativity);
            this._atomNameText.DisplayText = atom.Name;
            this._atomValenceText.DisplayText = string.Format("Valence: {0}", atom.IonCharge);
        }
Ejemplo n.º 3
0
 public void PickNextAtom()
 {
     this._nextAtom = this._toolbox.GetNextAtom();
 }
Ejemplo n.º 4
0
        private bool tileFollowsDifficultyBalancingAlgorithm(Tile current, Atom proposedAtom)
        {
            IList<Tile> adjacents = this.getNonEmptyAdjacentTiles(current);

            if (adjacents.Count == 0)
            {
                return true;
            }
            else
            {
                IList<Tile> oppositeValence;

                if (proposedAtom.IonCharge > 0)
                {
                    oppositeValence = adjacents.Where(t => t.Atom.IonCharge < 0).ToList();
                }
                else
                {
                    oppositeValence = adjacents.Where(t => t.Atom.IonCharge > 0).ToList();
                }

                // Fail if 50% or more of atoms are opposite valence
                if (oppositeValence.Count >= 0.5 * adjacents.Count)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
Ejemplo n.º 5
0
 public Tile(Atom atom, Sprite atomSprite, Text atomText)
 {
     this._atom = atom;
     this._atomSprite = atomSprite;
     this._atomText = atomText;
 }
Ejemplo n.º 6
0
 internal void Empty()
 {
     this._atom = Atom.NONE;
 }