Examples of Dice


Examples of transientlibs.objects.general.Dice

        //Log.info(LName);
    }

    public void rollLooks (){
     Dice dice = new Dice();

        //Iterator<Interval> i = fromList.iterator();

        //while ((i.hasNext()) && (result == null)) {
//                nowInterval = i.next();

//        dice.addOption(Gender, ID);

        ArrayList<Looks> nowGroup;
        LookType nowLookType;
        Looks nowLook;
        int nowType;
        int nowID;

        //fill all look types
        //Log.info("Look types count: " + Looks.lookTypes.size());

        for (nowType = 0; nowType < Looks.lookTypes.size(); nowType++) {

            //nowLookType = Looks.lookTypes.get(nowType);

            nowGroup = Looks.looks.get(nowType);
            //Log.info(nowLookType+": "+LName);

            //fill all looks of this type
            for (nowID = 0; nowID < nowGroup.size(); nowID++) {
                dice.addOption(nowGroup.get(nowID).frequency, nowID);

                //Log.info("Filling chances for look " + nowGroup.get(nowID).LName);
            }

            dice.rollDice();

            looks.add(new SmallPoints(dice.resultID, 100));

            //Log.info("Rolled "+nowGroup.get(dice.resultID).LName);

            dice.reset();

        }
    }
View Full Code Here

Examples of transientlibs.objects.general.Dice

        }
    }

    public void rollJob (){

        Dice dice = new Dice();
        int nowID;

for (nowID = 0; nowID < Job.jobs.size(); nowID++) {
                dice.addOption(Job.jobs.get(nowID).frequency, nowID);
            }

            dice.rollDice();

            job = Job.jobs.get(dice.resultID);


    }
View Full Code Here

Examples of util.Dice

    // ITC mechanism
    Bag<Stamp> bag = new Bag<Stamp>();
    Stamp seed = new Stamp();
    bag.push(seed);

    Dice dice = new Dice();
    int i, j;

    for (i = 0; i < nRep - 1; i++) {

      //fork
      Stamp s = bag.pop();
      Stamp s2 = s.fork();
      bag.push(s);
      bag.push(s2);

      //size
      float size = 0.0f;
      float size_for_one = 0.0f;
      for (Stamp st : bag.getList()) {
        size += st.sizeInBytes();
      }
      size_for_one = (size / nRep);

      //printing
      if (i % 5000 == 0) {
        System.out.println("It " + i + " - nRep " + bag.getSize() + " - sizeBytes T: " + size + " A:" + size_for_one);
      }
      out.write(i + "\t" + size_for_one + "\n");
    }

    for (; i < nIter; i++) {
      Stamp s;
      Stamp s2;

      //fork
      int sizeBag = bag.getSize();
      int nForks = (nRep + 1) - sizeBag;
//      System.out.println("nForks "+nForks);
      for (j = 0; j < nForks; j++) {
        s = bag.pop();
        s2 = s.fork();
        bag.push(s);
        bag.push(s2);
      }

      //event
      s = bag.pop();
      s.event();
      bag.push(s);

      //join
      s = bag.pop();
      s2 = bag.pop();
      if (dice.roll() >= (ratio_loss * 100)) {
        s = Stamp.join(s, s2);
      } else {
//        System.out.println("LOSS");
      }
      bag.push(s);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.