Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > BlueJ don't know what i did wrong

Reply
Thread Tools

BlueJ don't know what i did wrong

 
 
BlueJguywithoutskill
Guest
Posts: n/a
 
      02-22-2013
Hello,
I wanted to write a program for a table top Game (Heroscape, which should give me random units and if a unit got support units there should be a chance that it give me them too. And that until i got my points.

Tt do like planned for some units but then just stop to give out anymore and just loading .... hope somebody can help me.... if there are questions pls just ask them


public class ZufaelligeFiguren
{

public String [] Name;
public int [] Punkte;
public int [] Stuetze;
public int [] help;
public int [] zahl;
public int [] nochda;

public ZufaelligeFiguren()
{
Name = new String [159];
Stuetze = new int [159];
Punkte = new int [159];
nochda = new int [159];
help = new int [159];
zahl = new int [159];
Name[0] = "Cyprien Esenwein";
Punkte[0] = 150;
Stuetze[0] = 0;
Name[1] = "Otonashi";
Punkte[1] = 10;
Stuetze[1] = 0;
Name[2] = "Isamu";
Punkte[2] = 10;
Stuetze[2] = 0;
Name[3] = "Kyntela Gwyn"; //Elf
Punkte[3] = 20;
Stuetze[3] = 8;
zahl[3] = 0;
help[1] = 49; //Sonlen
help[2] = 47; //Ulginesh
help[3] = 33; //Syvarris
help[4] = 32; //Jorhdawn
help[5] = 27; //Chardris
help[6] = 25; //Emirroon
help[7] = 11; //Arkmer
help[8] = 105; //Warriors of Ashra
Name[4] = "Marcu Esenwein";
Punkte[4] = 20;
Stuetze[4] = 0;
Name[5] = "Dumutef Guard" ; //Devourer
Punkte[5] = 25;
Stuetze[5] = 2;
zahl[5] = 8;
help[9] = 4; //Marcu Esenwein
help[10] = 14; //Rechets of Bogdan
Name[6] = "Marrden Nagrubs"; //Hivelord
Punkte[6] = 30;
Stuetze[6] = 2;
zahl[6] = 10;
help[11] = 51; //Su-Bak-Na
help[12] = 55; //Tor-Kul-Na
Name[7] = "Fyorlag Spiders"; //Predator
Punkte[7] = 40;
Stuetze[7] = 1;
zahl[7] = 12;
help[13] = 123; //Wyvern
Name[8] = "Ashigaru Yari";
Punkte[8] = 40;
Stuetze[8] = 0;
Name[9] = "Sonya Esenwein";
Punkte[9] = 45;
Stuetze[9] = 1;
zahl[9] = 13;
help[14] = 0; //Cyprien Esenwein
Name[10] = "Tarn Viking Warriors";
Punkte[10] = 50;
Stuetze[10] = 0;
Name[11] = "Arkmer"; //Elf
Punkte[11] = 50;
Stuetze[11] = 8;
zahl[11] = 14;
help[15] = 49; //Sonlen
help[16] = 47; //Ulginesh
help[17] = 33; //Syvarris
help[18] = 32; //Jorhdawn
help[19] = 27; //Chardris
help[20] = 25; //Emirroon
help[21] = 3; //Kyntella Gwyn
help[22] = 105; //Warriors of Ashra
Name[12] = "Marro Warriors";
Punkte[12] = 50;
Stuetze[12] = 0;
Name[13] = "Iskra Esenwein"; //Rechets of Bogdan
Punkte[13] = 50;
Stuetze[13] = 1;
zahl[13] = 22;
help[23] = 14; //Rechets of Bogdan
Name[14] = "Rechets of Bogdan"; //Iskra Esenwein
Punkte[14] = 50;
Stuetze[14] = 1;
zahl[14] = 23;
help[24] = 13; //Iskra Esenwein
Name[15] = "Marro Drudge";
Punkte[15] = 50;
Stuetze[15] = 0;
Name[16] = "Ashigaru Harquebus";
Punkte[16] = 60;
Stuetze[16] = 0;
Name[17] = "Izumi Samurai";
Punkte[17] = 60;
Stuetze[17] = 0;
Name[18] = "Shiori";
Punkte[18] = 60;
Stuetze[18] = 0;
Name[19] = "Marro Stingers";
Punkte[19] = 60;
Stuetze[19] = 0;
Name[20] = "Zettian Guards";
Punkte[20] = 70;
Stuetze[20] = 0;
Name[21] = "10th Regiment of Foot";
Punkte[21] = 75;
Stuetze[21] = 0;
Name[22] = "Thorgrimm the Viking Champion";
Punkte[22] = 80;
Stuetze[22] = 0;
Name[23] = "Finn the Viking Champion";
Punkte[23] = 80;
Stuetze[23] = 0;
Name[24] = "Realin the Kyrie Varrior";
Punkte[24] = 80;
Stuetze[24] = 0;
Name[25] = "Emirroon"; //Elf
Punkte[25] = 80;
Stuetze[25] = 8;
zahl[25] = 24;
help[25] = 49; //Sonlen
help[26] = 47; //Ulginesh
help[27] = 33; //Syvarris
help[28] = 32; //Jorhdawn
help[29] = 27; //Chardris
help[30] = 11; //Arkmer
help[31] = 3; //Kyntella Gwyn
help[32] = 105; //Warriors of Ashra
Name[26] = "Wolves of Badru"; //Darklord
Punkte[26] = 80;
Stuetze[26] = 1;
zahl[26] = 32;
help[33] = 154; //Werewolf Lord
Name[27] = "Chardris"; //Elf Wizard
Punkte[27] = 90;
Stuetze[27] = 5;
zahl[27] = 33;
help[34] = 3; //Kyntella Gwyn
help[35] = 11; //Arkmer
help[36] = 25; //Emirroon
help[37] = 32; //Jorhdawn
help[38] = 47; //Ulginesh
Name[28] = "Ne-Gok-Sa";
Punkte[28] = 90;
Stuetze[28] = 0;
Name[29] = "Warden 816"; //Guard
Punkte[29] = 90;
Stuetze[29] = 6;
zahl[29] = 38;
help[39] = 20; //Zettian Guards
help[40] = 6; //Marrden Nagrubs
help[41] = 5; //Dumutef Guard
help[42] = 99; //Drow Chainfighter
help[43] = 110; //Blastatrons
help[44] = 127; //Granite Guardians
Name[45] = "Krav Maga Agents";
Punkte[30] = 100;
Stuetze[30] = 0;
Name[31] = "Agent Carr";
Punkte[31] = 100;
Stuetze[31] = 0;
Name[32] = "Jorhdawn"; //Elf Wizard
Punkte[32] = 100;
Stuetze[32] = 5;
zahl[32] = 45;
help[46] = 3; //Kyntella Gwyn
help[47] = 11; //Arkmer
help[48] = 25; //Emirroon
help[49] = 27; //Chardris
help[50] = 47; //Ulginesh
Name[33] = "Syvarris";
Punkte[33] = 100;
Stuetze[33] = 0;
Name[34] = "Duend";
Punkte[34] = 110;
Stuetze[34] = 0;
Name[35] = "Airborne Elite";
Punkte[35] = 110;
Stuetze[35] = 0;
Name[36] = "Sgt. Drake Alexander";
Punkte[36] = 110;
Stuetze[36] = 0;
Name[37] = "Moriko";
Punkte[37] = 110;
Stuetze[37] = 0;
Name[38] = "Brunak";
Punkte[38] = 110;
Stuetze[38] = 0;
Name[39] = "Templar Cavalry";
Punkte[39] = 120;
Stuetze[39] = 0;
Name[40] = "Raelin the Kyrie Warrior";
Punkte[40] = 120;
Stuetze[40] = 0;
Name[41] = "Grimnak"; //Orc Warrior
Punkte[41] = 120;
Stuetze[41] = 1;
zahl[41] = 50;
help[51] = 88; //Blade Gruts
Name[42] = "Deathwalker 8000";
Punkte[42] = 130;
Stuetze[42] = 0;
Name[43] = "Grok Riders"; //Marror Warlord
Punkte[43] = 130;
Stuetze[43] = 1;
zahl[43] = 51;
help[52] = 28; //Ne-Gok-Sa
Name[44] = "Deathwalker 9000"; //Souldborg guard
Punkte[44] = 140;
Stuetze[44] = 2;
zahl[44] = 52;
help[53] = 20; //Zettian Guards
help[54] = 110; //Blastatrons
Name[45] = "Major Q10";
Punkte[45] = 150;
Stuetze[45] = 0;
Name[46] = "Sir Dupis"; //Knights
Punkte[46] = 150;
Stuetze[46] = 2;
zahl[46] = 54;
help[55] = 39; //Templar Cavalry
help[56] = 114; //Phantom Knights
Name[47] = "Ulginesh"; //Elf Wizard
Punkte[47] = 150;
Stuetze[47] = 5;
zahl[47] = 56;
help[57] = 3; //Kyntella Gwyn
help[58] = 11; //Arkmer
help[59] = 25; //Emirroon
help[60] = 27; //Chardris
help[61] = 32; //Jorhdawn
Name[48] = "Mimring";
Punkte[48] = 150;
Stuetze[48] = 0;
Name[49] = "Sonlen";
Punkte[49] = 160;
Stuetze[49] = 0;
Name[50] = "Marro Hive"; //small/medium common marro squad
Punkte[50] = 160;
Stuetze[50] = 3;
zahl[48] = 61;
help[62] = 19; //Marro Stingers
help[63] = 15; //Marro Drudge
help[64] = 82; //Marro Dividers
Name[51] = "Su-Bak-Na"; //marro/wulsino army card (20ger Wuerfel Faehigkeit
Punkte[51] = 160;
Stuetze[51] = 7;
zahl[51] = 64;
help[65] = 59; //Tor-Kul-Na
help[66] = 50; //Marro Hive
help[67] = 28; //Ne-Gok-Sa
help[68] = 62; //Marrden Hounds
help[69] = 19; //Marro Stingers
help[60] = 12; //Marro Warriors
help[71] = 82; //Marro Dividers
Name[52] = "Sgt. Drake Alexander";
Punkte[52] = 170;
Stuetze[52] = 0;
Name[53] = "Kato Katsuro"; //Samurai hero/squad
Punkte[53] = 200;
Stuetze[53] = 3;
zahl[53] = 71;
help[72] = 8; //Ashigaru Yari
help[73] = 16; //Ashigaru Harquebus
help[74] = 17; //Izumi Samurai
Name[54] = "Charos";
Punkte[54] = 210;
Stuetze[54] = 0;
Name[55] = "Tor-Kul-Na";
Punkte[55] = 220;
Stuetze[55] = 0;
Name[56] = "Johnny 'Shotgun' Sullivan";
Punkte[56] = 65;
Stuetze[56] = 0;
Name[57] = "Saylind the Kyrie Warrior";
Punkte[57] = 80;
Stuetze[57] = 0;
Name[58] = "Concan the Kyrie Warrior"; //Knights/Sentinels
Punkte[58] = 80;
Stuetze[58] = 4;
zahl[58] = 74;
help[75] = 65; //Sentinels of Jandar
help[76] = 46; //Sir Dupis
help[77] = 39; //Templar Cavalry
help[78] = 114; //Phantom Kights
Name[59] = "Shaolin Monks";
Punkte[59] = 80;
Stuetze[59] = 0;
Name[60] = "MacDirk Warriors"; //Human Champion
Punkte[60] = 80;
Stuetze[60] = 4;
zahl[60] = 78;
help[79] = 22; //Thorgrimm the Viking Champion
help[80] = 23; //Finn the Viking Champion
help[81] = 66; //Alistair MacDirk
help[82] = 120; //Sir Hawthorne
Name[61] = "Gorillinators";
Punkte[61] = 90;
Stuetze[61] = 0;
Name[62] = "Marrden Hounds";
Punkte[62] = 90;
Stuetze[62] = 0;
Name[63] = "Deathwalker 7000";
Punkte[63] = 100;
Stuetze[63] = 0;
Name[64] = "Microcorp Agents";
Punkte[64] = 100;
Stuetze[64] = 0;
Name[65] = "Sentinels of Jandar";
Punkte[65] = 110;
Stuetze[65] = 0;
Name[66] = "Alistair MacDirk";
Punkte[66] = 110;
Stuetze[66] = 0;
Name[67] = "Spider-Man";
Punkte[67] = 160;
Stuetze[67] = 0;
Name[68] = "Silver Surfer";
Punkte[68] = 320;
Stuetze[68] = 0;
Name[69] = "Abomination";
Punkte[69] = 320;
Stuetze[69] = 0;
Name[70] = "Thanos";
Punkte[70] = 360;
Stuetze[70] = 0;
Name[71] = "Captain Amerika";
Punkte[71] = 220;
Stuetze[71] = 0;
Name[72] = "Red Skull";
Punkte[72] = 190;
Stuetze[72] = 0;
Name[73] = "Doctor Doom";
Punkte[73] = 245;
Stuetze[73] = 0;
Name[74] = "Incredible Hulk";
Punkte[74] = 370;
Stuetze[74] = 0;
Name[75] = "Mohican River Tribe"; //unique Tribesman hero
Punkte[75] = 70;
Stuetze[75] = 1;
zahl[75] = 82;
help[83] = 84; //Brave Arrow
Name[76] = "Omnicron Repulsor"; //Jandar Souldborg
Punkte[76] = 40;
Stuetze[76] = 1;
zahl[76] = 83;
help[84] = 97; //Omnicron Snipers
Name[77] = "The Axegrinders of Burning Forge"; //Dwarf Hero
Punkte[77] = 70;
Stuetze[77] = 3;
zahl[77] = 84;
help[85] = 86; //Migol Ironwill
help[86] = 109; //Darrak Ambershardd
help[87] = 132; //Morgrimm Forgehammer
Name[78] = "Venom";
Punkte[78] = 150;
Stuetze[78] = 0;
Name[79] = "Iron Man";
Punkte[79] = 240;
Stuetze[79] = 0;
Name[80] = "Capuan Gladiators"; //human Gladiator Hero /Gladiator
Punkte[80] = 70;
Stuetze[80] = 0;
Name[81] = "Protectors of Ullar";
Punkte[81] = 110;
Stuetze[81] = 0;
Name[82] = "Marro Dividers";
Punkte[82] = 50;
Stuetze[82] = 0;
Name[83] = "Atlaga the Kyrie Warrior"; //Kyrie
Punkte[83] = 90;
Stuetze[83] = 8;
zahl[83] = 87;
help[88] = 65; //Sentinels of Jandar
help[89] = 81; //Protectors of Ullar
help[90] = 57; //Saylind the Kyrie Warrior
help[91] = 58; //Concan the Kyrie Warrior
help[92] = 24; //Raelin the Kyrie Warrior
help[93] = 40; //Raelin the Kyrie Warrior
help[94] = 90; //Kelda the Kyrie Warrior
help[95] = 92; //Taelord the Kyrie Warrior
Name[84] = "Brave Arrow"; //Scout
Punkte[84] = 50;
Stuetze[84] = 4;
zahl[84] = 95;
help[96] = 7; //Fyorlag Spyders
help[97] = 157; //Venoc Vipers
help[98] = 75; //Mohican River Tribe
help[99] = 126; //Elite Onyx Vipers
Name[85] = "Kumiko";
Punkte[85] = 80;
Stuetze[85] = 0;
Name[86] = "Migol Ironwill";
Punkte[86] = 110;
Stuetze[86] = 0;
Name[87] = "Tul-Bak-Ra"; //Marro Squad
Punkte[87] = 130;
Stuetze[87] = 5;
zahl[87] = 99;
help[100] = 19; //Marro Stingers
help[101] = 15; //Marro Drudge
help[102] = 82; //Marro Dividers
help[103] = 43; //Grok Riders
help[104] = 12; //Marro Warriors
Name[88] = "Blade Gruts"; //Orc Champion
Punkte[88] = 40;
Stuetze[88] = 3;
zahl[88] = 104;
help[105] = 94; //Tornak
help[106] = 106; //Nerak the Glacian Swog Rider
help[107] = 41; //Grimnak
Name[89] = "Arrow Gruts"; //Beast
Punkte[89] = 40;
Stuetze[89] = 2;
zahl[89] = 107;
help[108] = 48; //Mimring
help[109] = 117; //Ice Troll Berserker
Name[90] = "Kelda the Kyrie Warrior";
Punkte[90] = 80;
Stuetze[90] = 0;
Name[91] = "Marcus Decimus Gallus"; //Soldier
Punkte[91] = 100;
Stuetze[91] = 6;
zahl[91] = 109;
help[110] = 96; //Roman Legionnaires
help[111] = 35; //Sgt. Drake Alexander
help[112] = 36; //Airborne Elite
help[113] = 52; //Sgt. Drake Alexander
help[114] = 71; //Catain Amerika
help[115] = 147; //Warforge Soldier
Name[92] = "Taelord the Kyrie Warrior";
Punkte[92] = 180;
Stuetze[92] = 0;
Name[93] = "Venoc Warlord"; //Scout/frency power
Punkte[93] = 120;
Stuetze[93] = 4;
zahl[93] = 115;
help[116] = 7; //Fyorlag Spyders
help[117] = 157; //Venoc Vipers
help[118] = 75; //Mohican River Tribe
help[119] = 126; //Elite Onyx Vipers
Name[94] = "Tornak"; //Orc Warrior
Punkte[94] = 100;
Stuetze[94] = 1;
zahl[94] = 119;
help[120] = 88; //Blade Gruts
Name[95] = "Roman Archers";
Punkte[95] = 55;
Stuetze[95] = 0;
Name[96] = "Roman Legionnaires"; //Warlords
Punkte[96] = 50;
Stuetze[96] = 5;
zahl[96] = 119;
help[120] = 91; //Marcus Decimus Gallus
help[121] = 92; //Taelord the Kyrie Warrior
help[122] = 93; //Venoc Warlord
help[123] = 132; //Morgrimm Forgehammer
help[124] = 28; // Ne-Gok-Sa
Name[97] = "Omnicron Snipers";
Punkte[97] = 100;
Stuetze[97] = 0;
Name[98] = "Sahuagin Raider";
Punkte[98] = 25;
Stuetze[98] = 0;
Name[99] = "Drow Chainfighter";
Punkte[99] = 25;
Stuetze[99] = 0;
Name[100] = "Water Elemental";
Punkte[100] = 30;
Stuetze[100] = 0;
Name[101] = "Air Elemental";
Punkte[101] = 30;
Stuetze[101] = 0;
Name[102] = "Fire Elemental";
Punkte[102] = 35;
Stuetze[102] = 0;
Name[103] = "Earth Elemental";
Punkte[103] = 35;
Stuetze[103] = 0;
Name[104] = "Deathreavers";
Punkte[104] = 40;
Stuetze[104] = 0;
Name[105] = "Warriors of Ashra";
Punkte[105] = 50;
Stuetze[105] = 0;
Name[106] = "Nerak the Glacian Swog Rider"; //Orcs
Punkte[106] = 50;
Stuetze[106] = 5;
zahl[106] = 124;
help[125] = 88; //Blade Gruts
help[126] = 89; //Arrow Gruts
help[127] = 107; //Death Chasers of Thesk
help[128] = 94; //Tornak
help[129] = 41; //Grimnak
Name[107] = "Death Chasers of Theesk"; //Large and Wild Hero
Punkte[107] = 55;
Stuetze[107] = 3;
zahl[107] = 129;
help[130] = 106; //Nerak the Glacian Swog Rider
help[131] = 122; //Ogre Pulverizer
help[132] = 155; //Ogre Warhulk
Name[108] = "Greenscale Warriors";
Punkte[108] = 60;
Stuetze[108] = 0;
Name[109] = "Darrak Ambershardd";
Punkte[109] = 60;
Stuetze[109] = 0;
Name[110] = "Blastatrons"; //Gladiatrons/Vydar Souldborgs
Punkte[110] = 60;
Stuetze[110] = 1;
zahl[110] = 132;
help[133] = 45; //Major Q10
Name[111] = "Death Knights of Valkrill"; //small,medium or large relentless hero
Punkte[111] = 60;
Stuetze[111] = 4;
zahl[111] = 133;
help[134] = 4; //Marvu Esenwein
help[135] = 120; //Sir Hawthorne
help[136] = 92; //Taelord the Kyrie Warrior
help[137] = 101; //Air Elemental
Name[112] = "Mezzedemon Warmongers";
Punkte[112] = 65;
Stuetze[112] = 0;
Name[113] = "Deepwyrm Drow";
Punkte[113] = 70;
Stuetze[113] = 0;
Name[114] = "Phantom Knights";
Punkte[114] = 70;
Stuetze[114] = 0;
Name[115] = "Horned Skull Brutes"; //small goblins
Punkte[115] = 75;
Stuetze[115] = 1;
zahl[115] = 137;
help[138] = 146; //Goblin Cutters
Name[116] = "Erevan Sunshadow";
Punkte[116] = 80;
Stuetze[116] = 0;
Name[117] = "Ice Troll Berserker";
Punkte[117] = 85;
Stuetze[117] = 0;
Name[118] = "Feral Troll";
Punkte[118] = 90;
Stuetze[118] = 0;
Name[119] = "Brandis Skyhunter";
Punkte[119] = 90;
Stuetze[119] = 0;
Name[120] = "Sir Hawthorne";
Punkte[120] = 90;
Stuetze[120] = 0;
Name[121] = "Ogre Pulverizer";
Punkte[121] = 100;
Stuetze[121] = 0;
Name[122] = "Ana Karithon";
Punkte[122] = 100;
Stuetze[122] = 0;
Name[123] = "Wyvern";
Punkte[123] = 100;
Stuetze[123] = 0;
Name[124] = "Pelloth"; //Drow
Punkte[124] = 100;
Stuetze[124] = 3;
zahl[124] = 138;
help[139] = 158; //Estivara
help[140] = 113; //Deepwyrm Drow
help[141] = 99; //Drow Chainfighter
Name[125] = "Deathstalker";
Punkte[125] = 100;
Stuetze[125] = 0;
Name[126] = "Elite Onyx Vipers";
Punkte[126] = 100;
Stuetze[126] = 0;
Name[127] = "Granite Guardians";
Punkte[127] = 100;
Stuetze[127] = 0;
Name[128] = "Sharwin Wildborn";
Punkte[128] = 110;
Stuetze[128] = 0;
Name[129] = "Quassatch Hunters";
Punkte[129] = 100;
Stuetze[129] = 0;
Name[130] = "Evar Scarcarver";
Punkte[130] = 110;
Stuetze[130] = 0;
Name[131] = "Fen Hydra";
Punkte[131] = 120;
Stuetze[131] = 0;
Name[132] = "Morgrimm Forgehammer";
Punkte[132] = 120;
Stuetze[132] = 0;
Name[133] = "Torin";
Punkte[133] = 120;
Stuetze[133] = 0;
Name[134] = "Tandros Kreel";
Punkte[134] = 120;
Stuetze[134] = 0;
Name[135] = "Siege";
Punkte[135] = 120;
Stuetze[135] = 0;
Name[136] = "Greater Ice Elemental";
Punkte[136] = 130;
Stuetze[136] = 0;
Name[137] = "Eltahal";
Punkte[137] = 140;
Stuetze[137] = 0;
Name[138] = "Othkurik the black Dragon";
Punkte[138] = 140;
Stuetze[138] = 0;
Name[139] = "Frost Giant of Morh";
Punkte[139] = 140;
Stuetze[139] = 0;
Name[140] = "Master of the Hunt";
Punkte[140] = 140;
Stuetze[140] = 0;
Name[141] = "Moltenclaw";
Punkte[141] = 170;
Stuetze[141] = 0;
Name[142] = "Black Wyrmling"; //Wyrmling
Punkte[142] = 30;
Stuetze[142] = 3;
zahl[142] = 141;
help[142] = 143; //Red Wyrmling
help[143] = 144; //White Wyrmling
help[144] = 145; //Blue Wyrmling
Name[143] = "Red Wyrmling"; //Wyrmling
Punkte[143] = 30;
Stuetze[143] = 3;
zahl[142] = 144;
help[145] = 142; //Black Wyrmling
help[146] = 144; //White Wyrmling
help[147] = 145; //Blue Wyrmling
Name[144] = "White Wyrmling"; //Wyrmling
Punkte[144] = 30;
Stuetze[144] = 3;
zahl[142] = 147;
help[148] = 143; //Red Wyrmling
help[149] = 142; //Black Wyrmling
help[150] = 145; //Blue Wyrmling
Name[145] = "Blue Wyrmling"; //Wyrmling
Punkte[145] = 35;
Stuetze[145] = 3;
zahl[142] = 150;
help[151] = 143; //Red Wyrmling
help[152] = 144; //White Wyrmling
help[153] = 142; //Black Wyrmling
Name[146] = "Goblin Cutters";
Punkte[146] = 50;
Stuetze[146] = 0;
Name[147] = "Warforge Soldiers";
Punkte[147] = 80;
Stuetze[147] = 0;
Name[148] = "Heirloom";
Punkte[148] = 90;
Stuetze[148] = 0;
Name[149] = "Iron golem";
Punkte[149] = 100;
Stuetze[149] = 0;
Name[150] = "Mind Flayer Mastermind";
Punkte[150] = 100;
Stuetze[150] = 0;
Name[151] = "Mika Connour";
Punkte[151] = 110;
Stuetze[151] = 0;
Name[152] = "Rhogar Dragonspine";
Punkte[152] = 110;
Stuetze[152] = 0;
Name[153] = "Kurrok the Elementalist"; //kleiner oder mittlerer Elemental
Punkte[153] = 120;
Stuetze[153] = 4;
zahl[153] = 153;
help[154] = 110; //Water Elemental
help[155] = 111; //Air Elemtental
help[156] = 112; //Fire Elemental
help[157] = 113; //Earth Elemental
Name[154] = "Werewolf Lord";
Punkte[154] = 140;
Stuetze[154] = 0;
Name[155] = "Ogre Warhulk";
Punkte[155] = 150;
Stuetze[155] = 0;
Name[156] = "Shurrok";
Punkte[156] = 160;
Stuetze[156] = 0;
Name[157] = "Venoc Vipers";
Punkte[157] = 40;
Stuetze[157] = 0;
Name[158] = "Estivara";
Punkte[158] = 80;
Stuetze[158] = 1;
zahl[158] = 157;
help[158] = 7; //Fyorlag Spiders

for (int i=0;i<=158;i++)
{
nochda[i] = 1;
nochda[6] = 2;
nochda[15] = 2;
nochda[19] = 2;
}
}
public void Zufallsmonster (int PunkteproSpieler, int Spielerzahl)
{
int a = PunkteproSpieler;
int b = Spielerzahl;
int p = 0;
for(int j = 1; j<=Spielerzahl; j++)
{
p = 0;

System.out.println("Spieler" + j + ":");
while (p < a)
{
int k = (int) ((Math.random() * 15+1);
if (nochda[k]>=1&&k!=159)
{
System.out.println(Name[k]+" "+Punkte[k]);
nochda[k]=nochda[k]-1;
p=p+Punkte[k];
int c = (int) (Math.random()*10);
int g = 10;
while(c<7 && Stuetze[k]>0 && p < a)
{
int d = (int) (((Math.random() * Stuetze[k]) +1) + zahl[k]);
if (nochda[help[d]]!=0&&d!=Stuetze[k]+1+zahl[k])
{
System.out.println(Name[help[d]]+" "+Punkte[help[d]]);
nochda[help[d]]=nochda[help[d]]-1;
p=p+Punkte[help[d]];
for (int l = d;l<=Stuetze[k]-1;l++ )
{
help[l]=help[l+1];
Stuetze[k]=Stuetze[k]-1;

}
c = (int)(Math.random()*g);
g = g-1;
}
}
}
}
System.out.println("Gesamtpunkte : " + p);
System.out.println("-------------------------------------------");
}

}
}
 
Reply With Quote
 
 
 
 
Joerg Meier
Guest
Posts: n/a
 
      02-22-2013
On Fri, 22 Feb 2013 06:03:03 -0800 (PST), BlueJguywithoutskill wrote:

> Hello,
> I wanted to write a program for a table top Game (Heroscape, which should give me random units and if a unit got support units there should be a chance that it give me them too. And that until i got my points.


I'm giving some general advice, as I'm honestly too lazy to reverse
engineer your one-letter variable names - what is c ? b ? d ? g ? p ? l ? I
recommend using your IDEs refactoring to change those to proper variable
names. It causes undue and unneccessary cost when trying to see what the
code does.

I also recommend using English variable and class names. I know you are
German, I am too, but the Java language itself is already in English, and
switching back and forth between two languages every other word again
places undue strain on the readers (and the programmers) brain.
Additionally, it makes it harder to get help.

Speaking of which: de.comp.lang.java exists.

> public class ZufaelligeFiguren
> {
>
> public String [] Name;
> public int [] Punkte;
> public int [] Stuetze;
> public int [] help;
> public int [] zahl;
> public int [] nochda;
>
> public ZufaelligeFiguren()
> {
> Name = new String [159];
> Stuetze = new int [159];
> Punkte = new int [159];
> nochda = new int [159];
> help = new int [159];
> zahl = new int [159];
> Name[0] = "Cyprien Esenwein";
> Punkte[0] = 150;
> Stuetze[0] = 0;


Ewww. Instead, try something like this:

add a new class file named something like HeroscapeUnit that looks
something like:

public class HeroscapeUnit {
private String name;
private int points;
private int stuetze; // <- what does that word mean ?
private int amount;
private boolean available;

public HeroscapeUnit(String name; int points; int stuetze; int amount;
boolean available) {
this.name = name;
this.points = points;
this.stuetze = stuetze;
this.amount = amount;
this.available = available;
}

public String getName() { return name; }
public void setName(String newName) { name = newName; }
// ...
}

And then in your main program you can do this instead:

public class ZufaelligeFiguren {
private final ArrayList<HeroscapeUnit> units = new
ArrayList<HeroscapeUnit>();

public ZufaelligeFiguren() {
units.add(new HeroscapeUnit("Otonashi", 10, 0, 1, true);
units.add(new HeroscapeUnit("Isamu", 10, 0, 1, true);
units.add(new HeroscapeUnit("Kyntela Gwyn", 20, 8, 0, true);
// ...

I'll help you fix your problem code afte you at the very least made it more
readable. You are also welcome to post your question in German in
de.comp.lang.java which I also read and will reply to if you prefer.

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
 
Reply With Quote
 
 
 
 
marvin.radke@htp-tel.de
Guest
Posts: n/a
 
      02-22-2013
I will try like that out

the problem is we had this more then one class thing in school a moth ago and i didn't understood anything :/

btw. stuetze = Stütze was thought as shortform of "Unterstützung" or something similar

thank you will reply if i get problems with it

and do you know why it doesn't work like i tried it?
 
Reply With Quote
 
Joerg Meier
Guest
Posts: n/a
 
      02-22-2013
On Fri, 22 Feb 2013 07:13:33 -0800 (PST), http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> the problem is we had this more then one class thing in school a moth ago and i didn't understood anything :/


Well, there are tons of general programming tutorials available to help
with generals.

> and do you know why it doesn't work like i tried it?


No, the code where the problem is is too convoluted with those one letter
variables for me to bother making sense of. I would if I got paid by the
hour, but not in my free time Like I said, I'll happily look at it after
you go over it and make it more readable.

Or alternatively you can wait for the US crowd to wake up, there's a bunch
of posters here who honestly seem to go through every kind of code no
matter how horrible just so they can post a reply.

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
 
Reply With Quote
 
marvin.radke@htp-tel.de
Guest
Posts: n/a
 
      02-22-2013
okay i will try to do it with two classes till tomorrow and if that don't work will make it read able if no US Guy will look over it

thank you
 
Reply With Quote
 
Eric Sosman
Guest
Posts: n/a
 
      02-22-2013
On 2/22/2013 10:24 AM, Joerg Meier wrote:
> [...]
> Or alternatively you can wait for the US crowd to wake up, there's a bunch
> of posters here who honestly seem to go through every kind of code no
> matter how horrible just so they can post a reply.


Me! Me! Oooh goody goody -- a chance to post a reply!

One difficulty with figuring out the problem is that we don't
know how the code was run. There's a class with a constructor
(which really should be redesigned along the lines Joerg suggests)
and a method, but we haven't seen the code that calls the method,
so we don't know what argument values are used. That's important,
because it looks like the method loops until the `p' sum grows as
large as the PunkteproSpieler value. If that value is too large
all the nochda[] values might decrease to zero -- and thereafter
the method would just keep looping and looping forever, looking
for a non-zero nochda[k] that it will never find.

On your next attempt please provide not only the code of the
class, but also the code that uses it. At the very least, tell
us what values PunkteproSpieler and Spielerzahl have when the
method is called.

--
Eric Sosman
(E-Mail Removed)d
 
Reply With Quote
 
markspace
Guest
Posts: n/a
 
      02-22-2013
On 2/22/2013 6:03 AM, BlueJguywithoutskill wrote:

> Tt do like planned for some units but then just stop to give out
> anymore and just loading .... hope somebody can help me.... if there
> are questions pls just ask them


Following Joerg's excellent advice, something else you should consider
is to refactor your code into smaller methods. Then add a test harness
to test one at a time that each one does what you intend.

This will aid you not only in understanding the current code, but in
debugging (it will be easier to find bugs with smaller methods and a
test harness) and understanding the code itself after a period of time
is also easier.

 
Reply With Quote
 
marvin.radke@htp-tel.de
Guest
Posts: n/a
 
      02-24-2013
I hope that is what you meant by making it easierr to read:


public class RandomFigures
{

public String [] Name;
public int [] points;
public int [] assisting;
public int [] help;
public int [] helpstillyet;
public int [] stillthere;

public RandomFigures()
{
Name = new String [159];
assisting = new int [159];
points = new int [159];
stillthere = new int [159];
help = new int [159];
helpstillyet = new int [159];
Name[0] = "Cyprien Esenwein";
points[0] = 150;
assisting[0] = 0;
Name[1] = "Otonashi";
points[1] = 10;
assisting[1] = 0;
Name[2] = "Isamu";
points[2] = 10;
assisting[2] = 0;
Name[3] = "Kyntela Gwyn"; //Elf
points[3] = 20;
assisting[3] = 8;
helpstillyet[3] = 0;
help[1] = 49; //Sonlen
help[2] = 47; //Ulginesh
help[3] = 33; //Syvarris
help[4] = 32; //Jorhdawn
help[5] = 27; //Chardris
help[6] = 25; //Emirroon
help[7] = 11; //Arkmer
help[8] = 105; //Warriors of Ashra
Name[4] = "Marcu Esenwein";
points[4] = 20;
assisting[4] = 0;
Name[5] = "Dumutef Guard" ; //Devourer
points[5] = 25;
assisting[5] = 2;
helpstillyet[5] = 8;
help[9] = 4; //Marcu Esenwein
help[10] = 14; //Rechets of Bogdan
Name[6] = "Marrden Nagrubs"; //Hivelord
points[6] = 30;
assisting[6] = 2;
helpstillyet[6] = 10;
help[11] = 51; //Su-Bak-Na
help[12] = 55; //Tor-Kul-Na
Name[7] = "Fyorlag Spiders"; //Predator
points[7] = 40;
assisting[7] = 1;
helpstillyet[7] = 12;
help[13] = 123; //Wyvern
Name[8] = "Ashigaru Yari";
points[8] = 40;
assisting[8] = 0;
Name[9] = "Sonya Esenwein";
points[9] = 45;
assisting[9] = 1;
helpstillyet[9] = 13;
help[14] = 0; //Cyprien Esenwein
Name[10] = "Tarn Viking Warriors";
points[10] = 50;
assisting[10] = 0;
Name[11] = "Arkmer"; //Elf
points[11] = 50;
assisting[11] = 8;
helpstillyet[11] = 14;
help[15] = 49; //Sonlen
help[16] = 47; //Ulginesh
help[17] = 33; //Syvarris
help[18] = 32; //Jorhdawn
help[19] = 27; //Chardris
help[20] = 25; //Emirroon
help[21] = 3; //Kyntella Gwyn
help[22] = 105; //Warriors of Ashra
Name[12] = "Marro Warriors";
points[12] = 50;
assisting[12] = 0;
Name[13] = "Iskra Esenwein"; //Rechets of Bogdan
points[13] = 50;
assisting[13] = 1;
helpstillyet[13] = 22;
help[23] = 14; //Rechets of Bogdan
Name[14] = "Rechets of Bogdan"; //Iskra Esenwein
points[14] = 50;
assisting[14] = 1;
helpstillyet[14] = 23;
help[24] = 13; //Iskra Esenwein
Name[15] = "Marro Drudge";
points[15] = 50;
assisting[15] = 0;
Name[16] = "Ashigaru Harquebus";
points[16] = 60;
assisting[16] = 0;
Name[17] = "Izumi Samurai";
points[17] = 60;
assisting[17] = 0;
Name[18] = "Shiori";
points[18] = 60;
assisting[18] = 0;
Name[19] = "Marro Stingers";
points[19] = 60;
assisting[19] = 0;
Name[20] = "Zettian Guards";
points[20] = 70;
assisting[20] = 0;
Name[21] = "10th Regiment of Foot";
points[21] = 75;
assisting[21] = 0;
Name[22] = "Thorgrimm the Viking Champion";
points[22] = 80;
assisting[22] = 0;
Name[23] = "Finn the Viking Champion";
points[23] = 80;
assisting[23] = 0;
Name[24] = "Realin the Kyrie Varrior";
points[24] = 80;
assisting[24] = 0;
Name[25] = "Emirroon"; //Elf
points[25] = 80;
assisting[25] = 8;
helpstillyet[25] = 24;
help[25] = 49; //Sonlen
help[26] = 47; //Ulginesh
help[27] = 33; //Syvarris
help[28] = 32; //Jorhdawn
help[29] = 27; //Chardris
help[30] = 11; //Arkmer
help[31] = 3; //Kyntella Gwyn
help[32] = 105; //Warriors of Ashra
Name[26] = "Wolves of Badru"; //Darklord
points[26] = 80;
assisting[26] = 1;
helpstillyet[26] = 32;
help[33] = 154; //Werewolf Lord
Name[27] = "Chardris"; //Elf Wizard
points[27] = 90;
assisting[27] = 5;
helpstillyet[27] = 33;
help[34] = 3; //Kyntella Gwyn
help[35] = 11; //Arkmer
help[36] = 25; //Emirroon
help[37] = 32; //Jorhdawn
help[38] = 47; //Ulginesh
Name[28] = "Ne-Gok-Sa";
points[28] = 90;
assisting[28] = 0;
Name[29] = "Warden 816"; //Guard
points[29] = 90;
assisting[29] = 6;
helpstillyet[29] = 38;
help[39] = 20; //Zettian Guards
help[40] = 6; //Marrden Nagrubs
help[41] = 5; //Dumutef Guard
help[42] = 99; //Drow Chainfighter
help[43] = 110; //Blastatrons
help[44] = 127; //Granite Guardians
Name[45] = "Krav Maga Agents";
points[30] = 100;
assisting[30] = 0;
Name[31] = "Agent Carr";
points[31] = 100;
assisting[31] = 0;
Name[32] = "Jorhdawn"; //Elf Wizard
points[32] = 100;
assisting[32] = 5;
helpstillyet[32] = 45;
help[46] = 3; //Kyntella Gwyn
help[47] = 11; //Arkmer
help[48] = 25; //Emirroon
help[49] = 27; //Chardris
help[50] = 47; //Ulginesh
Name[33] = "Syvarris";
points[33] = 100;
assisting[33] = 0;
Name[34] = "Duend";
points[34] = 110;
assisting[34] = 0;
Name[35] = "Airborne Elite";
points[35] = 110;
assisting[35] = 0;
Name[36] = "Sgt. Drake Alexander";
points[36] = 110;
assisting[36] = 0;
Name[37] = "Moriko";
points[37] = 110;
assisting[37] = 0;
Name[38] = "Brunak";
points[38] = 110;
assisting[38] = 0;
Name[39] = "Templar Cavalry";
points[39] = 120;
assisting[39] = 0;
Name[40] = "Raelin the Kyrie Warrior";
points[40] = 120;
assisting[40] = 0;
Name[41] = "Grimnak"; //Orc Warrior
points[41] = 120;
assisting[41] = 1;
helpstillyet[41] = 50;
help[51] = 88; //Blade Gruts
Name[42] = "Deathwalker 8000";
points[42] = 130;
assisting[42] = 0;
Name[43] = "Grok Riders"; //Marror Warlord
points[43] = 130;
assisting[43] = 1;
helpstillyet[43] = 51;
help[52] = 28; //Ne-Gok-Sa
Name[44] = "Deathwalker 9000"; //Souldborg guard
points[44] = 140;
assisting[44] = 2;
helpstillyet[44] = 52;
help[53] = 20; //Zettian Guards
help[54] = 110; //Blastatrons
Name[45] = "Major Q10";
points[45] = 150;
assisting[45] = 0;
Name[46] = "Sir Dupis"; //Knights
points[46] = 150;
assisting[46] = 2;
helpstillyet[46] = 54;
help[55] = 39; //Templar Cavalry
help[56] = 114; //Phantom Knights
Name[47] = "Ulginesh"; //Elf Wizard
points[47] = 150;
assisting[47] = 5;
helpstillyet[47] = 56;
help[57] = 3; //Kyntella Gwyn
help[58] = 11; //Arkmer
help[59] = 25; //Emirroon
help[60] = 27; //Chardris
help[61] = 32; //Jorhdawn
Name[48] = "Mimring";
points[48] = 150;
assisting[48] = 0;
Name[49] = "Sonlen";
points[49] = 160;
assisting[49] = 0;
Name[50] = "Marro Hive"; //small/medium common marro squad
points[50] = 160;
assisting[50] = 3;
helpstillyet[48] = 61;
help[62] = 19; //Marro Stingers
help[63] = 15; //Marro Drudge
help[64] = 82; //Marro Dividers
Name[51] = "Su-Bak-Na"; //marro/wulsino army card (20ger Wuerfel Faehigkeit
points[51] = 160;
assisting[51] = 7;
helpstillyet[51] = 64;
help[65] = 59; //Tor-Kul-Na
help[66] = 50; //Marro Hive
help[67] = 28; //Ne-Gok-Sa
help[68] = 62; //Marrden Hounds
help[69] = 19; //Marro Stingers
help[60] = 12; //Marro Warriors
help[71] = 82; //Marro Dividers
Name[52] = "Sgt. Drake Alexander";
points[52] = 170;
assisting[52] = 0;
Name[53] = "Kato Katsuro"; //Samurai hero/squad
points[53] = 200;
assisting[53] = 3;
helpstillyet[53] = 71;
help[72] = 8; //Ashigaru Yari
help[73] = 16; //Ashigaru Harquebus
help[74] = 17; //Izumi Samurai
Name[54] = "Charos";
points[54] = 210;
assisting[54] = 0;
Name[55] = "Tor-Kul-Na";
points[55] = 220;
assisting[55] = 0;
Name[56] = "Johnny 'Shotgun' Sullivan";
points[56] = 65;
assisting[56] = 0;
Name[57] = "Saylind the Kyrie Warrior";
points[57] = 80;
assisting[57] = 0;
Name[58] = "Concan the Kyrie Warrior"; //Knights/Sentinels
points[58] = 80;
assisting[58] = 4;
helpstillyet[58] = 74;
help[75] = 65; //Sentinels of Jandar
help[76] = 46; //Sir Dupis
help[77] = 39; //Templar Cavalry
help[78] = 114; //Phantom Kights
Name[59] = "Shaolin Monks";
points[59] = 80;
assisting[59] = 0;
Name[60] = "MacDirk Warriors"; //Human Champion
points[60] = 80;
assisting[60] = 4;
helpstillyet[60] = 78;
help[79] = 22; //Thorgrimm the Viking Champion
help[80] = 23; //Finn the Viking Champion
help[81] = 66; //Alistair MacDirk
help[82] = 120; //Sir Hawthorne
Name[61] = "Gorillinators";
points[61] = 90;
assisting[61] = 0;
Name[62] = "Marrden Hounds";
points[62] = 90;
assisting[62] = 0;
Name[63] = "Deathwalker 7000";
points[63] = 100;
assisting[63] = 0;
Name[64] = "Microcorp Agents";
points[64] = 100;
assisting[64] = 0;
Name[65] = "Sentinels of Jandar";
points[65] = 110;
assisting[65] = 0;
Name[66] = "Alistair MacDirk";
points[66] = 110;
assisting[66] = 0;
Name[67] = "Spider-Man";
points[67] = 160;
assisting[67] = 0;
Name[68] = "Silver Surfer";
points[68] = 320;
assisting[68] = 0;
Name[69] = "Abomination";
points[69] = 320;
assisting[69] = 0;
Name[70] = "Thanos";
points[70] = 360;
assisting[70] = 0;
Name[71] = "Captain Amerika";
points[71] = 220;
assisting[71] = 0;
Name[72] = "Red Skull";
points[72] = 190;
assisting[72] = 0;
Name[73] = "Doctor Doom";
points[73] = 245;
assisting[73] = 0;
Name[74] = "Incredible Hulk";
points[74] = 370;
assisting[74] = 0;
Name[75] = "Mohican River Tribe"; //unique Tribesman hero
points[75] = 70;
assisting[75] = 1;
helpstillyet[75] = 82;
help[83] = 84; //Brave Arrow
Name[76] = "Omnicron Repulsor"; //Jandar Souldborg
points[76] = 40;
assisting[76] = 1;
helpstillyet[76] = 83;
help[84] = 97; //Omnicron Snipers
Name[77] = "The Axegrinders of Burning Forge"; //Dwarf Hero
points[77] = 70;
assisting[77] = 3;
helpstillyet[77] = 84;
help[85] = 86; //Migol Ironwill
help[86] = 109; //Darrak Ambershardd
help[87] = 132; //Morgrimm Forgehammer
Name[78] = "Venom";
points[78] = 150;
assisting[78] = 0;
Name[79] = "Iron Man";
points[79] = 240;
assisting[79] = 0;
Name[80] = "Capuan Gladiators"; //human Gladiator Hero /Gladiator
points[80] = 70;
assisting[80] = 0;
Name[81] = "Protectors of Ullar";
points[81] = 110;
assisting[81] = 0;
Name[82] = "Marro Dividers";
points[82] = 50;
assisting[82] = 0;
Name[83] = "Atlaga the Kyrie Warrior"; //Kyrie
points[83] = 90;
assisting[83] = 8;
helpstillyet[83] = 87;
help[88] = 65; //Sentinels of Jandar
help[89] = 81; //Protectors of Ullar
help[90] = 57; //Saylind the Kyrie Warrior
help[91] = 58; //Concan the Kyrie Warrior
help[92] = 24; //Raelin the Kyrie Warrior
help[93] = 40; //Raelin the Kyrie Warrior
help[94] = 90; //Kelda the Kyrie Warrior
help[95] = 92; //Taelord the Kyrie Warrior
Name[84] = "Brave Arrow"; //Scout
points[84] = 50;
assisting[84] = 4;
helpstillyet[84] = 95;
help[96] = 7; //Fyorlag Spyders
help[97] = 157; //Venoc Vipers
help[98] = 75; //Mohican River Tribe
help[99] = 126; //Elite Onyx Vipers
Name[85] = "Kumiko";
points[85] = 80;
assisting[85] = 0;
Name[86] = "Migol Ironwill";
points[86] = 110;
assisting[86] = 0;
Name[87] = "Tul-Bak-Ra"; //Marro Squad
points[87] = 130;
assisting[87] = 5;
helpstillyet[87] = 99;
help[100] = 19; //Marro Stingers
help[101] = 15; //Marro Drudge
help[102] = 82; //Marro Dividers
help[103] = 43; //Grok Riders
help[104] = 12; //Marro Warriors
Name[88] = "Blade Gruts"; //Orc Champion
points[88] = 40;
assisting[88] = 3;
helpstillyet[88] = 104;
help[105] = 94; //Tornak
help[106] = 106; //Nerak the Glacian Swog Rider
help[107] = 41; //Grimnak
Name[89] = "Arrow Gruts"; //Beast
points[89] = 40;
assisting[89] = 2;
helpstillyet[89] = 107;
help[108] = 48; //Mimring
help[109] = 117; //Ice Troll Berserker
Name[90] = "Kelda the Kyrie Warrior";
points[90] = 80;
assisting[90] = 0;
Name[91] = "Marcus Decimus Gallus"; //Soldier
points[91] = 100;
assisting[91] = 6;
helpstillyet[91] = 109;
help[110] = 96; //Roman Legionnaires
help[111] = 35; //Sgt. Drake Alexander
help[112] = 36; //Airborne Elite
help[113] = 52; //Sgt. Drake Alexander
help[114] = 71; //Catain Amerika
help[115] = 147; //Warforge Soldier
Name[92] = "Taelord the Kyrie Warrior";
points[92] = 180;
assisting[92] = 0;
Name[93] = "Venoc Warlord"; //Scout/frency power
points[93] = 120;
assisting[93] = 4;
helpstillyet[93] = 115;
help[116] = 7; //Fyorlag Spyders
help[117] = 157; //Venoc Vipers
help[118] = 75; //Mohican River Tribe
help[119] = 126; //Elite Onyx Vipers
Name[94] = "Tornak"; //Orc Warrior
points[94] = 100;
assisting[94] = 1;
helpstillyet[94] = 119;
help[120] = 88; //Blade Gruts
Name[95] = "Roman Archers";
points[95] = 55;
assisting[95] = 0;
Name[96] = "Roman Legionnaires"; //Warlords
points[96] = 50;
assisting[96] = 5;
helpstillyet[96] = 119;
help[120] = 91; //Marcus Decimus Gallus
help[121] = 92; //Taelord the Kyrie Warrior
help[122] = 93; //Venoc Warlord
help[123] = 132; //Morgrimm Forgehammer
help[124] = 28; // Ne-Gok-Sa
Name[97] = "Omnicron Snipers";
points[97] = 100;
assisting[97] = 0;
Name[98] = "Sahuagin Raider";
points[98] = 25;
assisting[98] = 0;
Name[99] = "Drow Chainfighter";
points[99] = 25;
assisting[99] = 0;
Name[100] = "Water Elemental";
points[100] = 30;
assisting[100] = 0;
Name[101] = "Air Elemental";
points[101] = 30;
assisting[101] = 0;
Name[102] = "Fire Elemental";
points[102] = 35;
assisting[102] = 0;
Name[103] = "Earth Elemental";
points[103] = 35;
assisting[103] = 0;
Name[104] = "Deathreavers";
points[104] = 40;
assisting[104] = 0;
Name[105] = "Warriors of Ashra";
points[105] = 50;
assisting[105] = 0;
Name[106] = "Nerak the Glacian Swog Rider"; //Orcs
points[106] = 50;
assisting[106] = 5;
helpstillyet[106] = 124;
help[125] = 88; //Blade Gruts
help[126] = 89; //Arrow Gruts
help[127] = 107; //Death Chasers of Thesk
help[128] = 94; //Tornak
help[129] = 41; //Grimnak
Name[107] = "Death Chasers of Theesk"; //Large and Wild Hero
points[107] = 55;
assisting[107] = 3;
helpstillyet[107] = 129;
help[130] = 106; //Nerak the Glacian Swog Rider
help[131] = 122; //Ogre Pulverizer
help[132] = 155; //Ogre Warhulk
Name[108] = "Greenscale Warriors";
points[108] = 60;
assisting[108] = 0;
Name[109] = "Darrak Ambershardd";
points[109] = 60;
assisting[109] = 0;
Name[110] = "Blastatrons"; //Gladiatrons/Vydar Souldborgs
points[110] = 60;
assisting[110] = 1;
helpstillyet[110] = 132;
help[133] = 45; //Major Q10
Name[111] = "Death Knights of Valkrill"; //small,medium or large relentless hero
points[111] = 60;
assisting[111] = 4;
helpstillyet[111] = 133;
help[134] = 4; //Marvu Esenwein
help[135] = 120; //Sir Hawthorne
help[136] = 92; //Taelord the Kyrie Warrior
help[137] = 101; //Air Elemental
Name[112] = "Mezzedemon Warmongers";
points[112] = 65;
assisting[112] = 0;
Name[113] = "Deepwyrm Drow";
points[113] = 70;
assisting[113] = 0;
Name[114] = "Phantom Knights";
points[114] = 70;
assisting[114] = 0;
Name[115] = "Horned Skull Brutes"; //small goblins
points[115] = 75;
assisting[115] = 1;
helpstillyet[115] = 137;
help[138] = 146; //Goblin Cutters
Name[116] = "Erevan Sunshadow";
points[116] = 80;
assisting[116] = 0;
Name[117] = "Ice Troll Berserker";
points[117] = 85;
assisting[117] = 0;
Name[118] = "Feral Troll";
points[118] = 90;
assisting[118] = 0;
Name[119] = "Brandis Skyhunter";
points[119] = 90;
assisting[119] = 0;
Name[120] = "Sir Hawthorne";
points[120] = 90;
assisting[120] = 0;
Name[121] = "Ogre Pulverizer";
points[121] = 100;
assisting[121] = 0;
Name[122] = "Ana Karithon";
points[122] = 100;
assisting[122] = 0;
Name[123] = "Wyvern";
points[123] = 100;
assisting[123] = 0;
Name[124] = "Pelloth"; //Drow
points[124] = 100;
assisting[124] = 3;
helpstillyet[124] = 138;
help[139] = 158; //Estivara
help[140] = 113; //Deepwyrm Drow
help[141] = 99; //Drow Chainfighter
Name[125] = "Deathstalker";
points[125] = 100;
assisting[125] = 0;
Name[126] = "Elite Onyx Vipers";
points[126] = 100;
assisting[126] = 0;
Name[127] = "Granite Guardians";
points[127] = 100;
assisting[127] = 0;
Name[128] = "Sharwin Wildborn";
points[128] = 110;
assisting[128] = 0;
Name[129] = "Quassatch Hunters";
points[129] = 100;
assisting[129] = 0;
Name[130] = "Evar Scarcarver";
points[130] = 110;
assisting[130] = 0;
Name[131] = "Fen Hydra";
points[131] = 120;
assisting[131] = 0;
Name[132] = "Morgrimm Forgehammer";
points[132] = 120;
assisting[132] = 0;
Name[133] = "Torin";
points[133] = 120;
assisting[133] = 0;
Name[134] = "Tandros Kreel";
points[134] = 120;
assisting[134] = 0;
Name[135] = "Siege";
points[135] = 120;
assisting[135] = 0;
Name[136] = "Greater Ice Elemental";
points[136] = 130;
assisting[136] = 0;
Name[137] = "Eltahal";
points[137] = 140;
assisting[137] = 0;
Name[138] = "Othkurik the black Dragon";
points[138] = 140;
assisting[138] = 0;
Name[139] = "Frost Giant of Morh";
points[139] = 140;
assisting[139] = 0;
Name[140] = "Master of the Hunt";
points[140] = 140;
assisting[140] = 0;
Name[141] = "Moltenclaw";
points[141] = 170;
assisting[141] = 0;
Name[142] = "Black Wyrmling"; //Wyrmling
points[142] = 30;
assisting[142] = 3;
helpstillyet[142] = 141;
help[142] = 143; //Red Wyrmling
help[143] = 144; //White Wyrmling
help[144] = 145; //Blue Wyrmling
Name[143] = "Red Wyrmling"; //Wyrmling
points[143] = 30;
assisting[143] = 3;
helpstillyet[142] = 144;
help[145] = 142; //Black Wyrmling
help[146] = 144; //White Wyrmling
help[147] = 145; //Blue Wyrmling
Name[144] = "White Wyrmling"; //Wyrmling
points[144] = 30;
assisting[144] = 3;
helpstillyet[142] = 147;
help[148] = 143; //Red Wyrmling
help[149] = 142; //Black Wyrmling
help[150] = 145; //Blue Wyrmling
Name[145] = "Blue Wyrmling"; //Wyrmling
points[145] = 35;
assisting[145] = 3;
helpstillyet[142] = 150;
help[151] = 143; //Red Wyrmling
help[152] = 144; //White Wyrmling
help[153] = 142; //Black Wyrmling
Name[146] = "Goblin Cutters";
points[146] = 50;
assisting[146] = 0;
Name[147] = "Warforge Soldiers";
points[147] = 80;
assisting[147] = 0;
Name[148] = "Heirloom";
points[148] = 90;
assisting[148] = 0;
Name[149] = "Iron golem";
points[149] = 100;
assisting[149] = 0;
Name[150] = "Mind Flayer Mastermind";
points[150] = 100;
assisting[150] = 0;
Name[151] = "Mika Connour";
points[151] = 110;
assisting[151] = 0;
Name[152] = "Rhogar Dragonspine";
points[152] = 110;
assisting[152] = 0;
Name[153] = "Kurrok the Elementalist"; //kleiner oder mittlerer Elemental
points[153] = 120;
assisting[153] = 4;
helpstillyet[153] = 153;
help[154] = 110; //Water Elemental
help[155] = 111; //Air Elemtental
help[156] = 112; //Fire Elemental
help[157] = 113; //Earth Elemental
Name[154] = "Werewolf Lord";
points[154] = 140;
assisting[154] = 0;
Name[155] = "Ogre Warhulk";
points[155] = 150;
assisting[155] = 0;
Name[156] = "Shurrok";
points[156] = 160;
assisting[156] = 0;
Name[157] = "Venoc Vipers";
points[157] = 40;
assisting[157] = 0;
Name[158] = "Estivara";
points[158] = 80;
assisting[158] = 1;
helpstillyet[158] = 157;
help[158] = 7; //Fyorlag Spiders

for (int i=0;i<=158;i++)
{
stillthere[i] = 1;
stillthere[6] = 2;
stillthere[15] = 2;
stillthere[19] = 2;
}
}
public void Random (int pointsperPlayer, int numberofplayers)
{


int pointsuntilnow = 0;
for(int j = 1; j<=numberofplayers; j++)
{
pointsuntilnow = 0;

System.out.println("Spieler" + j + ":");
while (pointsuntilnow < pointsperPlayer)
{
int k = (int) ((Math.random() * 15+1);
if (stillthere[k]>=1&&k!=159)
{
System.out.println(Name[k]+" "+points[k]);
stillthere[k]=stillthere[k]-1;
pointsuntilnow=pointsuntilnow+points[k];
int chanceofhelpunit = (int) (Math.random()*10);
int chancefactor = 10;
while(chanceofhelpunit<7 && assisting[k]>0 && pointsuntilnow < pointsperPlayer)
{
int whohelps = (int) (((Math.random() * assisting[k]) +1) + helpstillyet[k]);
if (stillthere[help[whohelps]]!=0&&whohelps!=assisting[k]+1+helpstillyet[k])
{
System.out.println(Name[help[whohelps]]+" "+points[help[whohelps]]);
stillthere[help[whohelps]]=stillthere[help[whohelps]]-1;
pointsuntilnow=pointsuntilnow+points[help[whohelps]];
for (int l = whohelps;l<=assisting[k]-1;l++ )
{
help[l]=help[l+1];
assisting[k]=assisting[k]-1;

}
chanceofhelpunit = (int)(Math.random()*chancefactor);
chancefactor = chancefactor-1;
}
}
}
}
System.out.println("Your Points : " + pointsuntilnow);
System.out.println("-------------------------------------------");
}

}
}



it works if i just take the part up to the first time chanceofhelpunit with values up to pointsperplayer * numberofplayers = 12000

hope thats what you wanted to know
 
Reply With Quote
 
Joerg Meier
Guest
Posts: n/a
 
      02-24-2013
On Sun, 24 Feb 2013 02:27:52 -0800 (PST), (E-Mail Removed) wrote:

> I hope that is what you meant by making it easierr to read:


> [...]


> it works if i just take the part up to the first time chanceofhelpunit with values up to pointsperplayer * numberofplayers = 12000


> hope thats what you wanted to know


Yes, that looks a little better. What happens is this: every player gets
assigned units, and then that unit gets marked as 'spent'. You only have
15,895 points in total, and your routine 'overspends', meaning if you set
the limit to 100 points, a player with 90 points spent still gets assigned
a unit, so they end up with more than 100 points.

After a while, all units are assigned to someone. If you give it 100
players, which a point limit of 1000 each, then the first ~15 get all the
units, and then there are no more units left for the remaining players.

That is a problem in your logic - not a code problem. You have to think
about what you want to happen in this case, and then change the code to
make that happen.

Right now, the culprit are these lines:

int k = (int) ((Math.random() * 15+1);
if (stillthere[k]>=1&&k!=159) {...

When all units are spent, then stillthere[k] will always be zero, no matter
what k you get.

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
 
Reply With Quote
 
marvin.radke@htp-tel.de
Guest
Posts: n/a
 
      02-24-2013
ah sorry i said it wrong^^

it would work with this values (if i have luck)

but i tried it with very low values : 4000 and 2 players, but it stops before it finished player 1
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Bluej-announce] NetBeans IDE 5.0 BlueJ Edition Released IchBin Java 0 07-29-2006 04:13 AM
NetBeans IDE to Provide Support for Leading Educational Tool: BlueJ IchBin Java 0 03-15-2006 06:25 PM
trouble installing BlueJ - no Java system installed Tim923 Java 13 02-03-2005 07:43 PM
Re: bluej help Steve Horsley Java 1 10-21-2003 10:18 PM
BlueJ Arguments Edward Rice Java 1 07-04-2003 02:42 PM



Advertisments