You are viewing our Forum Archives. To view or take place in current topics click here.
Need a bit of Java help.
Posted:

Need a bit of Java help.Posted:

5FDP_Jekyll
  • E3 2017
Status: Offline
Joined: May 27, 201112Year Member
Posts: 2,048
Reputation Power: 100
Status: Offline
Joined: May 27, 201112Year Member
Posts: 2,048
Reputation Power: 100
Been a while since I've posted here in the programming forums. However, I am a bit stumped on an issue I'm having with creating a sort of simple java program. Currently only doing it to be used with the console. So on to my issue.

I'm trying to make a breeding calculator for Ark: Survival Evolved by using the source of a web app that is no longer being developed but has posted their source code for it.

Anyways here are some of the codes that relate specifically to what I'm trying to do. Also, the web app was coded in Angular JS.

First I'll post his source code that I believe is relative:

$scope.foods={

      'Raw Meat': {
         food: 50,
         stack: 20,
         spoil: 10*60,
         weight: 0.1,
         waste: 0
      },

$scope.creatures={

      Giganotosaurus: {
         birthtype: "Incubation",
         foods: $scope.foodlists.Carnivore,
         babyfoodrate: 55,
         agespeed: 0.000003,
         agespeedmult: 0.33,
         eggspeed: 0.005556,
         eggspeedmult: 0.1,
         maxfoodrate: 5.7,
         minfoodrate: 0.1,
         weight: 700
      },

creature.maturationprogress=creature.currentweight/creature.finalweight;
creature.foodratedecay=(creature.maxfoodrate-creature.minfoodrate)/creature.maturationtime;
creature.maturationprogress=creature.currentweight/creature.finalweight;
creature.maturationtimecomplete=creature.maturationtime*creature.maturationprogress;


creature.currentbabybuffer=creature.currentweight/$scope.foods[$scope.foodunit].weight*$scope.foods[$scope.foodunit].food/(creature.maxfoodrate-creature.foodratedecay*creature.maturationtimecomplete);


Below is my code that I believe is relevant:


      final int rawmeatvalue = 0;
      final int rawmeatstack = 20;
      final int rawmeatspoil = 10*60;
      final double rawmeatweight = 0.1;
      final int waste = 0;

      double maxfoodrate = 0.0;
      double minfoodrate = 0.0;
      double fooddecay = 0.0;
      double agespeed = 0.0;
      double agemult = 0.0;
      double maturationspeed = 1.0;
      
      double maturationtime = 0.0;
      double cw = 0.0;
      double mw = 0.0;
      double maturation = 0;
      double maturecomplete = 0.0;
      double buffer = 0.0;

      int hours = 0;
      int minutes = 0;
      int seconds = 0;

System.out.println("Please choose an option for " + creature);
      for (String s : list) {
         System.out.println(s);
      }
      
      
      option = reader.nextInt();
      if (option == 1)
      {
      
      System.out.println("Enter current weight: ");
      cw = reader.nextDouble();
      
      System.out.println("Enter maximum weight: ");
      mw = reader.nextDouble();
      
      maturationtime = 1 / agespeed / agemult / maturationspeed;
      maturation = cw/mw;
      maturecomplete = maturationtime*maturation;
      fooddecay = (maxfoodrate - minfoodrate) / maturation;
      buffer = (((cw / rawmeatweight) * rawmeatvalue) / (maxfoodrate - fooddecay)) * maturecomplete;
      
      
      timeins = buffer;
      
      time = Math.round(timeins/60);
      
      while (timeins > 59) {
         timeins = timeins - 60;
         minutes = minutes + 1;
         }
      
      seconds = (int)timeins;
         
      
      System.out.println("Current buffer: " + minutes + " minutes and " + seconds + " seconds");
      }


The code is pretty messy right now as I'm waiting on refining it until I get it more sorted in how I want it to be. But if you need more info in order to help me, just ask and I'll try to answer to my best ability.

A bit more info:


  • I'm reading the agespeed, agemult, maxfood and minfood from a file. Those values are read correctly, hence why I didn't include them.
  • There is more to the code, however, I do not believe it is directly related to my issue. If needed I will post my entire source under a spoiler.


Thanks for any help.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.