• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:06
CEST 03:06
KST 10:06
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL59Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event19Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Program: SC2 / XSplit / OBS Scene Switcher Statistics for vetoed/disliked maps The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
FEL Cracov 2025 (July 27) - $8000 live event RSL: Revival, a new crowdfunded tournament series Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) [GSL 2025] Code S: Season 2 - Semi Finals & Finals
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL SC uni coach streams logging into betting site BGH Mineral Boosts Tutorial Video Player “Jedi” cheat on CSL Replays question
Tourneys
[Megathread] Daily Proleagues [BSL20] Grand Finals - Sunday 20:00 CET Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Trading/Investing Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 690 users

The Big Programming Thread - Page 729

Forum Index > General Forum
Post a Reply
Prev 1 727 728 729 730 731 1031 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
Spain17970 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
Poland17243 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
Spain17970 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
Poland17243 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
Spain17970 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
Poland17243 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 8h 54m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 245
NeuroSwarm 154
ProTech78
ROOTCatZ 55
RuFF_SC2 46
StarCraft: Brood War
NaDa 115
yabsab 42
Icarus 4
Dota 2
febbydoto12
Counter-Strike
Fnx 1570
Stewie2K809
Heroes of the Storm
Khaldor218
Other Games
summit1g9593
tarik_tv7848
JimRising 515
fl0m421
ViBE150
Organizations
Other Games
BasetradeTV12
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• Berry_CruncH274
• davetesta35
• Hunta15 4
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• Azhi_Dahaki36
• Pr0nogo 3
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21171
• Ler73
League of Legends
• Doublelift6374
• Jankos1704
Upcoming Events
RSL Revival
8h 54m
Clem vs Classic
SHIN vs Cure
FEL
10h 54m
WardiTV European League
10h 54m
BSL: ProLeague
16h 54m
Dewalt vs Bonyth
Replay Cast
1d 22h
Sparkling Tuna Cup
2 days
WardiTV European League
2 days
The PondCast
3 days
Replay Cast
3 days
RSL Revival
4 days
[ Show More ]
Replay Cast
4 days
RSL Revival
5 days
FEL
5 days
RSL Revival
6 days
FEL
6 days
FEL
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.