• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 14:15
CET 20:15
KST 04:15
  • 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
HomeStory Cup 28 - Info & Preview11Rongyi Cup S3 - Preview & Info3herO wins SC2 All-Star Invitational14SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8
Community News
Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win3Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)38
StarCraft 2
General
HomeStory Cup 28 - Info & Preview StarCraft 2 Not at the Esports World Cup 2026 Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win Oliveira Would Have Returned If EWC Continued herO wins SC2 All-Star Invitational
Tourneys
HomeStory Cup 28 KSL Week 85 $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship $70 Prize Pool Ladder Legends Academy Weekly Open!
Strategy
Simple Questions Simple Answers
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 510 Safety Violation Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained
Brood War
General
[ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ Bleak Future After Failed ProGaming Career BW General Discussion Potential ASL qualifier breakthroughs?
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 Azhi's Colosseum - Season 2 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Path of Exile Mobile Legends: Bang Bang Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Gold Bars & Gold Nuggets for sale+27 73 799 4524
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
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Let's Get Creative–Video Gam…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1645 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
Spain18206 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
Poland17644 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
Spain18206 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
Poland17644 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
Spain18206 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
Poland17644 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
HomeStory Cup
12:00
Day 2
TaKeTV4286
ComeBackTV 1107
IndyStarCraft 491
SteadfastSC443
TaKeSeN 332
Rex104
CosmosSc2 86
3DClanTV 84
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 491
SteadfastSC 443
ProTech115
Rex 104
CosmosSc2 86
BRAT_OK 62
JuggernautJason61
StarCraft: Brood War
Shuttle 300
Larva 273
Rock 30
Free 29
Shine 21
Sacsri 12
soO 11
ivOry 4
Dota 2
Gorgc4839
qojqva2516
Dendi589
420jenkins404
monkeys_forever10
Counter-Strike
fl0m4184
kRYSTAL_38
Heroes of the Storm
Liquid`Hasu483
Khaldor385
Trikslyr72
MindelVK11
Other Games
FrodaN7092
Grubby2969
Mlord620
crisheroes364
KnowMe97
ToD27
Organizations
Other Games
EGCTV1469
gamesdonequick1236
BasetradeTV31
StarCraft 2
angryscii 22
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• printf 23
• iHatsuTV 20
• Response 1
• Kozan
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• FirePhoenix33
• 80smullet 5
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV468
League of Legends
• Jankos3087
• imaqtpie2038
Counter-Strike
• Shiphtur292
Upcoming Events
Replay Cast
4h 45m
HomeStory Cup
17h 45m
OSC
17h 45m
Replay Cast
1d 4h
Replay Cast
2 days
Wardi Open
2 days
WardiTV Invitational
3 days
The PondCast
4 days
WardiTV Invitational
4 days
Liquipedia Results

Completed

Escore Tournament S1: W6
OSC Championship Season 13
Underdog Cup #3

Ongoing

CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Acropolis #4 - TS4
Proleague 2026-01-31
Rongyi Cup S3
HSC XXVIII
Nations Cup 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8

Upcoming

Escore Tournament S1: W7
Escore Tournament S1: W8
Acropolis #4
IPSL Spring 2026
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
LiuLi Cup: 2025 Grand Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
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 © 2026 TLnet. All Rights Reserved.