• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:42
CET 13:42
KST 21:42
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
Weekly Cups (Nov 3-9): Clem Conquers in Canada2SC: Evo Complete - Ranked Ladder OPEN ALPHA7StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Weekly Cups (Nov 3-9): Clem Conquers in Canada Mech is the composition that needs teleportation t Craziest Micro Moments Of All Time? RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Should offensive tower rushing be viable in RTS games? Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1883 users

The Big Programming Thread - Page 729

Forum Index > General Forum
Post a Reply
Prev 1 727 728 729 730 731 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Acrofales
Profile Joined August 2010
Spain18113 Posts
May 16 2016 02:19 GMT
#14561
if netlogo can't handle it, you probably need to rethink your ABM. If your models simply take too long to simulate, you can think of distributing your model in a cluster and run various simulations in parallel. Nevertheless, hundreds of agents with 60 variables each sounds like a rather heavy model, although it obviously also depends on your update rules, how much of it you want to visualize, etc. etc. In general, netlogo is pretty good at scaling things, so if it's not managing, you are probably (1) doing something wrong, or (2) doing something that requires more computing power than you have available.

If this is your first attempt at ABMS, I suggest trying a more modest approach. Complex systems are plenty hard enough to study with just a few variables.
xuanzue
Profile Joined October 2010
Colombia1747 Posts
May 16 2016 02:35 GMT
#14562
to make clear, my problem is the amount of time coding.

in netlogo I put like 5-6variables, and had to quit because the procedural assignation on every variable was too long to code.

in c# is quite quicker to code but I miss the features of netlogo to make the agents move.

in every tick at most 40 agents are changing, so the pc power is not a problem (yet)


Dominions 4: "Thrones of Ascension".
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2016-05-17 11:31:31
May 17 2016 11:28 GMT
#14563
What book/resources do you guys recommend for writing better code? I started reading Clean Code but I didn't really agree when it came to the point of him saying to keep functions very short to the point where they're 5-6 lines long. Personally, I think when you try to make code too short you just end up creating a deep and unnecessary rabbit hole. It also doesn't seem like a common practice from what I've seen.
solidbebe
Profile Blog Joined November 2010
Netherlands4921 Posts
May 17 2016 14:39 GMT
#14564
On May 17 2016 20:28 Itsmedudeman wrote:
What book/resources do you guys recommend for writing better code? I started reading Clean Code but I didn't really agree when it came to the point of him saying to keep functions very short to the point where they're 5-6 lines long. Personally, I think when you try to make code too short you just end up creating a deep and unnecessary rabbit hole. It also doesn't seem like a common practice from what I've seen.

I dont agree with you. You want to generalize code as much as possible and keeping functions short is a way to go about this. It does depend on the language and what youre working on of course. If you write functions which are significantly longer than 5 - 10 lines there's a good chance your function is taking on more responsibility than it should.
That's the 2nd time in a week I've seen someone sig a quote from this GD and I have never witnessed a sig quote happen in my TL history ever before. -Najda
Manit0u
Profile Blog Joined August 2004
Poland17426 Posts
May 17 2016 14:58 GMT
#14565
On May 17 2016 23:39 solidbebe wrote:
Show nested quote +
On May 17 2016 20:28 Itsmedudeman wrote:
What book/resources do you guys recommend for writing better code? I started reading Clean Code but I didn't really agree when it came to the point of him saying to keep functions very short to the point where they're 5-6 lines long. Personally, I think when you try to make code too short you just end up creating a deep and unnecessary rabbit hole. It also doesn't seem like a common practice from what I've seen.

I dont agree with you. You want to generalize code as much as possible and keeping functions short is a way to go about this. It does depend on the language and what youre working on of course. If you write functions which are significantly longer than 5 - 10 lines there's a good chance your function is taking on more responsibility than it should.


+1

Try debugging some 1k+ lines long functions written 10 years ago and you'll see how keeping them short can improve the quality of life.
Time is precious. Waste it wisely.
Fwmeh
Profile Joined April 2008
1286 Posts
May 17 2016 15:35 GMT
#14566
On May 17 2016 20:28 Itsmedudeman wrote:
What book/resources do you guys recommend for writing better code? I started reading Clean Code but I didn't really agree when it came to the point of him saying to keep functions very short to the point where they're 5-6 lines long. Personally, I think when you try to make code too short you just end up creating a deep and unnecessary rabbit hole. It also doesn't seem like a common practice from what I've seen.

I would strongly urge you to reconcider, w.r.t. Clean Code in general, and specifically regarding short functions.

With modern IDEs and refactoring tools, very rarely do you need 10+ lines in a function, even more so in modern languages.

In my personal opinion, long methods show a lack of skill, laziness, or both.
A parser for things is a function from strings to lists of pairs of things and strings
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2016-05-17 16:37:29
May 17 2016 16:30 GMT
#14567
Reading your own 10+ line function may be fine, but reading someone else's can be a headache. Especially your own code 2 weeks later.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
May 17 2016 16:30 GMT
#14568
--- Nuked ---
Acrofales
Profile Joined August 2010
Spain18113 Posts
May 17 2016 16:33 GMT
#14569
On May 16 2016 11:35 xuanzue wrote:
to make clear, my problem is the amount of time coding.

in netlogo I put like 5-6variables, and had to quit because the procedural assignation on every variable was too long to code.

in c# is quite quicker to code but I miss the features of netlogo to make the agents move.

in every tick at most 40 agents are changing, so the pc power is not a problem (yet)




Yeah, this doesn't make any sense to me. Here is a (local) variable assignment in netlogo:

let myvariable 0


and a global is the same with set, instead of let, and you have to declare it global.

Here is the same in c++


int myvariable = 0;


Now I won't claim that netlogo is compact, or a great language to code in. It's a very simple language meant for exactly one thing: allowing non-programmers to build social simulations. But it's pretty good at what it does.

Maybe I'm not understanding your problem, though...
Manit0u
Profile Blog Joined August 2004
Poland17426 Posts
May 17 2016 17:36 GMT
#14570
Just learn Lisp and do whatever you want. You can program the way you program in it.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
May 17 2016 18:06 GMT
#14571
The average method certainly shouldn't be longer than 10 lines of code (however you define that...). And no single line should do multiple conceptual things at once. I.e. I accept
var a = b.Where(condition).ToList();
but I don't accept
var a = b[i++];
.

There definitely are times when longer methods are justified. This occasionally happens when the code is performance-critical (always profile first). And sometimes you just need to do 10 steps at an equal level of abstraction in a certain order without a reasonable grouping. But for every long method there should be a bunch of short ones.

Just write your code without worrying about length at first. But if you are done and can select a couple of instructions and give those instructions a good name, chances are they should go into a seperate method. And if you then notice that you extracted a bunch of methods that deal with the same stuff, chances are they should go into a class of their own.

About the common practice argument: common practice does not guarantee quality in coding. The average programmer sadly isn't very good, and neither are some of their common practices.
If you have a good reason to disagree with the above, please tell me. Thank you.
xuanzue
Profile Joined October 2010
Colombia1747 Posts
May 18 2016 00:27 GMT
#14572
On May 18 2016 01:33 Acrofales wrote:
Show nested quote +
On May 16 2016 11:35 xuanzue wrote:
to make clear, my problem is the amount of time coding.

in netlogo I put like 5-6variables, and had to quit because the procedural assignation on every variable was too long to code.

in c# is quite quicker to code but I miss the features of netlogo to make the agents move.

in every tick at most 40 agents are changing, so the pc power is not a problem (yet)




Yeah, this doesn't make any sense to me. Here is a (local) variable assignment in netlogo:

let myvariable 0


and a global is the same with set, instead of let, and you have to declare it global.

Here is the same in c++


int myvariable = 0;



Now I won't claim that netlogo is compact, or a great language to code in. It's a very simple language meant for exactly one thing: allowing non-programmers to build social simulations. But it's pretty good at what it does.

Maybe I'm not understanding your problem, though...




assigning 50k variables (60 per agent) is much more quick with c, mostly because I can use for/switch/while/if, to procedurally assign them.

is there any method to import a big DB in netlogo and automatically assign all the variables? that will solve many of my problems tho.
my last attempt with nlogo was like:
+ Show Spoiler +


create-CLS 128
[set color 27
set alerted? false
set sleep? true
set work? false
set volver? false
]
create-UNV 128
[set color 117
set work? false
set sleep? true
set volver? false
]
create-EJC 128
[set color 17
set work? false
set sleep? true
set volver? false
]
create-PRR 128
[set color 47
set work? false
set sleep? true
set volver? false
]
create-AMZ 128
[set color 57
set work? true
set sleep? true
set volver? false
]
create-DLM 128
[set color 7
set work? false
set sleep? false
set volver? false
]
create-MDS 128
[set color 107
set work? false
set volver? false
set sleep? true ]
create-LFS 128
[set color 87
set work? false
set volver? false
set sleep? false
]
Dominions 4: "Thrones of Ascension".
Acrofales
Profile Joined August 2010
Spain18113 Posts
Last Edited: 2016-05-18 07:10:02
May 18 2016 06:39 GMT
#14573
On May 18 2016 09:27 xuanzue wrote:
Show nested quote +
On May 18 2016 01:33 Acrofales wrote:
On May 16 2016 11:35 xuanzue wrote:
to make clear, my problem is the amount of time coding.

in netlogo I put like 5-6variables, and had to quit because the procedural assignation on every variable was too long to code.

in c# is quite quicker to code but I miss the features of netlogo to make the agents move.

in every tick at most 40 agents are changing, so the pc power is not a problem (yet)




Yeah, this doesn't make any sense to me. Here is a (local) variable assignment in netlogo:

let myvariable 0


and a global is the same with set, instead of let, and you have to declare it global.

Here is the same in c++


int myvariable = 0;



Now I won't claim that netlogo is compact, or a great language to code in. It's a very simple language meant for exactly one thing: allowing non-programmers to build social simulations. But it's pretty good at what it does.

Maybe I'm not understanding your problem, though...




assigning 50k variables (60 per agent) is much more quick with c, mostly because I can use for/switch/while/if, to procedurally assign them.

is there any method to import a big DB in netlogo and automatically assign all the variables? that will solve many of my problems tho.
my last attempt with nlogo was like:
+ Show Spoiler +


create-CLS 128
[set color 27
set alerted? false
set sleep? true
set work? false
set volver? false
]
create-UNV 128
[set color 117
set work? false
set sleep? true
set volver? false
]
create-EJC 128
[set color 17
set work? false
set sleep? true
set volver? false
]
create-PRR 128
[set color 47
set work? false
set sleep? true
set volver? false
]
create-AMZ 128
[set color 57
set work? true
set sleep? true
set volver? false
]
create-DLM 128
[set color 7
set work? false
set sleep? false
set volver? false
]
create-MDS 128
[set color 107
set work? false
set volver? false
set sleep? true ]
create-LFS 128
[set color 87
set work? false
set volver? false
set sleep? false
]


I still don't understand the problem. Setting 50k variables is no harder than setting 60, assuming you have some configuration parameters that allows you to set your 60 variables per agent based on some configurations.

While Netlogo doesn't have switch statements, it does have ifelse, which'll do in a pinch. It also has loops, so that doesn't seem to be the problem.

You can do something like:


ask turtles [
ifelse cmd = "A" [ A-thing ]
[ ifelse cmd = "B" [ B-thing ]
[ ifelse cmd = "C" [ C-thing ]
[ default-thing
]]]
]

Unfortunately, this will accumulate a godawful number of closing brackets at the end, because you have to nest them. But it's a valid way of doing this.

You can also simulate a switch statement (if it is at the end of your procedure) with stop (which is equivalent to return, rather than break):


if is-abc? [ do-abc stop]
if is-def? [ do-def stop]


To help you with your specifics, I need more of an idea of what you're trying to do. Your code snippet seems fine, but I agree it'll get pretty shitty pretty quickly. There is probably an easier way of doing it, if there is some underlying meaning to CLS, UNV, etc. I assume there is, otherwise the work would be equally onerous in any other language.
xuanzue
Profile Joined October 2010
Colombia1747 Posts
Last Edited: 2016-05-18 10:59:35
May 18 2016 10:38 GMT
#14574
my objective is:

1 agent would be the aggressor trying to assimilate thousands of agents.

every agent has a different behavior, some will attempt to fight by themselves the threat, others will instead flee and warn near agents.

for example CLS are the kind of weak/flee and their variables will reflect that.

this is my actual map in c#:

+ Show Spoiler +
[image loading]


and this was my map in netlogo:

+ Show Spoiler +
[image loading]


the nodes 37-40 are the inner triangles
the nodes 55-58 are the other triangles

For example UNV will move between those triangles. in the example I breed 128 UNV turtles, but i needed the first 32 to stay moving between 34 and 55, the next 32 between 35 and 56 and so.

when I was working in netlogo I only had 7 variables and 8 kind of turtles that share some similarities.

Now in c# I have 23 kind of agents (turtles) and 20 variables ATM( but I know the variables can expand to 60)



in c# I first run a program to make a DB of variables and then I import it in the model. I'm thinking to change this to OOP

+ Show Spoiler +

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using System.IO;

namespace ConsoleApplication1
{
class Program


{
static void Main(string[] args)
{

int[] atturtle = { 0, 5 };
int[] dfturtle = { 0, 5 };
int[] alturtle = { 0, 5 };
int[, , ,] turtle = new int[17, 16, 8, 8];
int ataux;
int dfaux;
int alaux;
int auxfr;
int creduaux;
int hataux;
int voluntaux;
Random r = new Random(DateTime.Now.Millisecond);

for (int faccion = 0; faccion < 8; faccion++)
{

switch (faccion)
{

case 0:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 5;
creduaux = 3;
hataux = 2;
voluntaux = 1;
break;

case 1:
ataux = 1;
dfaux = 0;
alaux = 0;
auxfr = 6;
creduaux = 3;
hataux = 1;
voluntaux = 2;
break;
case 2:
ataux = 0;
dfaux = 0;
alaux = 1;
auxfr = 7;
creduaux = 1;
hataux = 1;
voluntaux = 1;
break;
case 3:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 10;
creduaux = 0;
hataux = 5;
voluntaux = 0;
break;
case 4:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 9;
creduaux = 3;
hataux = 5;
voluntaux = 0;
break;
case 5:
ataux = 2;
dfaux = 1;
alaux = 1;
auxfr = 7;
creduaux = 2;
hataux = 7;
voluntaux = 0;
break;
case 6:
ataux = 2;
dfaux = 2;
alaux = 0;
auxfr = 9;
creduaux = 2;
hataux = 1;
voluntaux = 2;
break;
case 7:
ataux = 0;
dfaux = 1;
alaux = 3;
auxfr = 21;
creduaux = 0;
hataux = 3;
voluntaux = 5;
break;
default:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 16;
creduaux = 0;
hataux = 3;
voluntaux = 5;
break;

}
for (int estab = 0; estab < 8; estab++)
{
for (int nume = 0; nume < 16; nume++)
{

turtle[0, nume, estab, faccion] = r.Next(atturtle[0], atturtle[1] + ataux);
turtle[1, nume, estab, faccion] = r.Next(dfturtle[0], dfturtle[1] + dfaux);
turtle[2, nume, estab, faccion] = r.Next(alturtle[0], alturtle[1] + alaux);
turtle[6, nume, estab, faccion] = r.Next(0, auxfr);
turtle[7, nume, estab, faccion] = r.Next(0, 32); //ruta
turtle[8, nume, estab, faccion] = r.Next(0, creduaux +1);
turtle[9, nume, estab, faccion] = r.Next(0, hataux + 3);
turtle[12, nume, estab, faccion] = r.Next(0, 10);
turtle[13, nume, estab, faccion] = r.Next(0, turtle[0, nume, estab, faccion] + turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion]);
turtle[14, nume, estab, faccion] = r.Next(0, 5+voluntaux);
if (turtle[6, nume, estab, faccion] == 0)
{
turtle[1, nume, estab, faccion]++; turtle[2, nume, estab, faccion]++;
turtle[16, nume, estab, faccion] = turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion];
}
else
{
turtle[16, nume, estab, faccion] = 1+ 2*(turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion]);
}
}


}
}


string arrays = "";
for (int ij = 0; ij < 8; ij++)
{
for (int k = 0; k < 8; k++)
{
for (int j = 0; j < 16; j++)
{
for (int i = 0; i < 16; i++)
{

arrays += Convert.ToString(turtle[i, j, k, ij]);
if (i < 15) { arrays += ","; }
if (i == 15) { arrays += "," + Convert.ToString(k) + ","+ Convert.ToString(ij)+"\n"; }


}

}
}
}
File.WriteAllText("d:\\arrayprueba.csv", arrays);

BinaryFormatter bf = new BinaryFormatter();
using (FileStream fs = new FileStream("d:\\arrayt.dat", FileMode.Create))
bf.Serialize(fs, turtle);
}
}
}



also I have another DB for possibles routes for every agent.

I have no big experience programming, so any info/docs to make things easier is appreciated.

thanks for stay answering me ^^
Dominions 4: "Thrones of Ascension".
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
May 18 2016 11:16 GMT
#14575
Has anybody here used the infamous nodejs library Windshaft? If yes, I have a few questions for you.
"windows bash is a steaming heap of shit" tofucake
Manit0u
Profile Blog Joined August 2004
Poland17426 Posts
May 18 2016 15:15 GMT
#14576
On May 18 2016 19:38 xuanzue wrote:
my objective is:

1 agent would be the aggressor trying to assimilate thousands of agents.

every agent has a different behavior, some will attempt to fight by themselves the threat, others will instead flee and warn near agents.

for example CLS are the kind of weak/flee and their variables will reflect that.

this is my actual map in c#:

+ Show Spoiler +
[image loading]


and this was my map in netlogo:

+ Show Spoiler +
[image loading]


the nodes 37-40 are the inner triangles
the nodes 55-58 are the other triangles

For example UNV will move between those triangles. in the example I breed 128 UNV turtles, but i needed the first 32 to stay moving between 34 and 55, the next 32 between 35 and 56 and so.

when I was working in netlogo I only had 7 variables and 8 kind of turtles that share some similarities.

Now in c# I have 23 kind of agents (turtles) and 20 variables ATM( but I know the variables can expand to 60)



in c# I first run a program to make a DB of variables and then I import it in the model. I'm thinking to change this to OOP

+ Show Spoiler +

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using System.IO;

namespace ConsoleApplication1
{
class Program


{
static void Main(string[] args)
{

int[] atturtle = { 0, 5 };
int[] dfturtle = { 0, 5 };
int[] alturtle = { 0, 5 };
int[, , ,] turtle = new int[17, 16, 8, 8];
int ataux;
int dfaux;
int alaux;
int auxfr;
int creduaux;
int hataux;
int voluntaux;
Random r = new Random(DateTime.Now.Millisecond);

for (int faccion = 0; faccion < 8; faccion++)
{

switch (faccion)
{

case 0:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 5;
creduaux = 3;
hataux = 2;
voluntaux = 1;
break;

case 1:
ataux = 1;
dfaux = 0;
alaux = 0;
auxfr = 6;
creduaux = 3;
hataux = 1;
voluntaux = 2;
break;
case 2:
ataux = 0;
dfaux = 0;
alaux = 1;
auxfr = 7;
creduaux = 1;
hataux = 1;
voluntaux = 1;
break;
case 3:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 10;
creduaux = 0;
hataux = 5;
voluntaux = 0;
break;
case 4:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 9;
creduaux = 3;
hataux = 5;
voluntaux = 0;
break;
case 5:
ataux = 2;
dfaux = 1;
alaux = 1;
auxfr = 7;
creduaux = 2;
hataux = 7;
voluntaux = 0;
break;
case 6:
ataux = 2;
dfaux = 2;
alaux = 0;
auxfr = 9;
creduaux = 2;
hataux = 1;
voluntaux = 2;
break;
case 7:
ataux = 0;
dfaux = 1;
alaux = 3;
auxfr = 21;
creduaux = 0;
hataux = 3;
voluntaux = 5;
break;
default:
ataux = 0;
dfaux = 0;
alaux = 0;
auxfr = 16;
creduaux = 0;
hataux = 3;
voluntaux = 5;
break;

}
for (int estab = 0; estab < 8; estab++)
{
for (int nume = 0; nume < 16; nume++)
{

turtle[0, nume, estab, faccion] = r.Next(atturtle[0], atturtle[1] + ataux);
turtle[1, nume, estab, faccion] = r.Next(dfturtle[0], dfturtle[1] + dfaux);
turtle[2, nume, estab, faccion] = r.Next(alturtle[0], alturtle[1] + alaux);
turtle[6, nume, estab, faccion] = r.Next(0, auxfr);
turtle[7, nume, estab, faccion] = r.Next(0, 32); //ruta
turtle[8, nume, estab, faccion] = r.Next(0, creduaux +1);
turtle[9, nume, estab, faccion] = r.Next(0, hataux + 3);
turtle[12, nume, estab, faccion] = r.Next(0, 10);
turtle[13, nume, estab, faccion] = r.Next(0, turtle[0, nume, estab, faccion] + turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion];
turtle[14, nume, estab, faccion] = r.Next(0, 5+voluntaux);
if (turtle[6, nume, estab, faccion] == 0)
{
turtle[1, nume, estab, faccion]++; turtle[2, nume, estab, faccion]++;
turtle[16, nume, estab, faccion] = turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion];
}
else
{
turtle[16, nume, estab, faccion] = 1+ 2*(turtle[9, nume, estab, faccion] + turtle[12, nume, estab, faccion];
}
}


}
}


string arrays = "";
for (int ij = 0; ij < 8; ij++)
{
for (int k = 0; k < 8; k++)
{
for (int j = 0; j < 16; j++)
{
for (int i = 0; i < 16; i++)
{

arrays += Convert.ToString(turtle[i, j, k, ij];
if (i < 15) { arrays += ","; }
if (i == 15) { arrays += "," + Convert.ToString(k) + ","+ Convert.ToString(ij)+"\n"; }


}

}
}
}
File.WriteAllText("d:\\arrayprueba.csv", arrays);

BinaryFormatter bf = new BinaryFormatter();
using (FileStream fs = new FileStream("d:\\arrayt.dat", FileMode.Create))
bf.Serialize(fs, turtle);
}
}
}



also I have another DB for possibles routes for every agent.

I have no big experience programming, so any info/docs to make things easier is appreciated.

thanks for stay answering me ^^


Just 2 things that come to mind after quickly glancing over it:

1. You should really split this into several functions.
2. Perhaps it could be much more brief if done recursively?
Time is precious. Waste it wisely.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
May 18 2016 15:58 GMT
#14577
The joy of working with student programmers:

foreach ($messages as $key => $message)
{
throw new \UserDB\Exception\AffiliateException($message);
}


I don't think that works as they think it works...

I have to rewrite the whole code they wrote in the last two weeks in two days because it's pure trash that doesn't even do what the task I gave them required, despite me making diagrams on the whiteboard and explaining everything twice while showing the code parts that needed to be changed and added.
phar
Profile Joined August 2011
United States1080 Posts
May 19 2016 02:55 GMT
#14578
Does your team not enforce code reviews before submission? :S That sounds painful.
Who after all is today speaking about the destruction of the Armenians?
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
May 19 2016 06:37 GMT
#14579
On May 19 2016 11:55 phar wrote:
Does your team not enforce code reviews before submission? :S That sounds painful.


I found that during the code review. I had let them work on the project in their own git branches for two weeks, since I had a few other urgent things to take care of and I wanted to see how they work without someone constantly looking over their shoulder. On Friday they said "yeah, we're finished, everything is tested and works" and on Tuesday my week was ruined when I checked out their branch for review. I would usually tell them what they did wrong and how to fix it, but in this case it's pretty much "everything" and we need that done by Monday, so I'll just finish the project myself and then show them how I wanted it to be. I did check their progress 2-3 times during that period, pointing at things that still need to be changed and it turned out that they didn't even change the places I showed them directly in the code. I probably should have checked on them more often, but I have neither the time nor the will to babysit them every day.

At least now I know that I can't give them anything more than menial work. I would fire them, but then we'd be 1.75 programmers (I've recently been promoted to project manager, though I'm still also programmer until we can find a replacement) and a trainee working on fairly large projects. For now we can at least still use them for the boring stuff that doesn't require any creative thought until we find someone who can actually program in a way that doesn't make my IDE cry.
Keniji
Profile Blog Joined April 2008
Netherlands2569 Posts
May 19 2016 10:10 GMT
#14580
On May 19 2016 00:58 Morfildur wrote:
The joy of working with student programmers:

foreach ($messages as $key => $message)
{
throw new \UserDB\Exception\AffiliateException($message);
}


I don't think that works as they think it works...

I have to rewrite the whole code they wrote in the last two weeks in two days because it's pure trash that doesn't even do what the task I gave them required, despite me making diagrams on the whiteboard and explaining everything twice while showing the code parts that needed to be changed and added.


So what did they try to do?

Is $messages some array of collected errror messages?

Prev 1 727 728 729 730 731 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Korean Royale
12:00
Group Stage 1 - Group B
WardiTV682
TKL 279
Rex110
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 279
RotterdaM 234
Lowko207
SortOf 125
Rex 110
StarCraft: Brood War
Calm 6256
Hyuk 2587
Soma 508
Stork 414
ZerO 343
Pusan 227
Rush 130
Barracks 126
hero 118
Killer 95
[ Show more ]
sSak 84
Sharp 73
Sea.KH 49
ToSsGirL 42
Noble 42
Aegong 40
Backho 39
zelot 37
Free 33
Icarus 26
Movie 21
Shine 18
Sexy 16
Terrorterran 14
sas.Sziky 1
Dota 2
Dendi583
XaKoH 452
XcaliburYe189
BananaSlamJamma2
Counter-Strike
olofmeister1886
byalli545
edward19
Other Games
B2W.Neo1129
crisheroes289
DeMusliM287
Pyrionflax216
Sick211
ZerO(Twitch)4
Organizations
StarCraft: Brood War
lovetv 13
StarCraft 2
IntoTheiNu 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Adnapsc2 5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota241
Upcoming Events
OSC
3h 18m
Replay Cast
10h 18m
Replay Cast
20h 18m
Kung Fu Cup
23h 18m
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
1d 10h
The PondCast
1d 21h
RSL Revival
1d 21h
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
1d 23h
WardiTV Korean Royale
1d 23h
PiGosaur Monday
2 days
[ Show More ]
RSL Revival
2 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
2 days
CranKy Ducklings
3 days
RSL Revival
3 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
3 days
BSL 21
4 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
4 days
RSL Revival
4 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
BSL 21
5 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
5 days
Monday Night Weeklies
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.