• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:31
CET 16:31
KST 00:31
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
ComeBackTV's documentary on Byun's Career !1Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win1Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
ComeBackTV's documentary on Byun's Career ! Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win Did they add GM to 2v2? RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship StarCraft2.fi 15th Anniversary Cup RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle How Rain Became ProGamer in Just 3 Months [BSL21] RO8 Bracket & Prediction Contest BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO8 - Day 2 - Sunday 21:00 CET [ASL20] Grand Finals [BSL21] RO8 - Day 1 - Saturday 21:00 CET
Strategy
Current Meta Simple Questions, Simple Answers Game Theory for Starcraft Fighting Spirit mining rates
Other Games
General Games
PC Games Sales Thread Stormgate/Frost Giant Megathread Path of Exile Dawn of War IV ZeroSpace Megathread
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
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
ゼントレーダーについて
Tech Support
Employee Retention in Behavioral Health: Building Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2028 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
Spain18146 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
Poland17530 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
Spain18146 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
Poland17530 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
Spain18146 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
Poland17530 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 2025
12:00
Playoffs
Scarlett vs ReynorLIVE!
TBD vs Clem
uThermal vs Shameless
WardiTV1383
ComeBackTV 612
TaKeTV 331
IndyStarCraft 214
Rex137
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko450
IndyStarCraft 214
Rex 137
ProTech115
trigger 14
DivinesiaTV 10
StarCraft: Brood War
Rain 2823
Jaedong 1955
Bisu 1880
Larva 829
GuemChi 773
Soma 739
Light 431
actioN 351
Stork 338
Mini 301
[ Show more ]
EffOrt 296
Snow 281
BeSt 278
hero 209
firebathero 172
Zeus 118
Hyun 67
Sea.KH 50
Killer 45
LaStScan 43
JYJ 40
Mind 39
sorry 37
yabsab 31
Shine 29
Aegong 23
sas.Sziky 20
Terrorterran 17
Oya187 16
Mong 12
NaDa 5
Dota 2
Gorgc5928
qojqva3121
syndereN371
BananaSlamJamma297
420jenkins282
XcaliburYe136
Dendi10
Counter-Strike
byalli383
markeloff109
Other Games
B2W.Neo2080
FrodaN924
hiko626
Hui .334
Fuzer 291
DeMusliM218
RotterdaM142
ArmadaUGS104
QueenE70
Trikslyr37
Organizations
StarCraft: Brood War
lovetv 5
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 21
• blackmanpl 18
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV715
• Noizen74
League of Legends
• Jankos3038
• TFBlade1384
Upcoming Events
PiGosaur Cup
9h 29m
WardiTV 2025
20h 29m
MaNa vs Gerald
TBD vs MaxPax
ByuN vs TBD
TBD vs ShoWTimE
OSC
23h 29m
YoungYakov vs Mixu
ForJumy vs TBD
Percival vs TBD
Shameless vs TBD
The PondCast
1d 18h
WardiTV 2025
1d 21h
Cure vs Creator
TBD vs Solar
WardiTV 2025
2 days
OSC
2 days
CranKy Ducklings
3 days
SC Evo League
3 days
Ladder Legends
4 days
[ Show More ]
BSL 21
4 days
Sparkling Tuna Cup
4 days
Ladder Legends
5 days
BSL 21
5 days
Replay Cast
5 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 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.