• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:46
CEST 03:46
KST 10:46
  • 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
Team TLMC #5 - Finalists & Open Tournaments0[ASL20] Ro16 Preview Pt2: Turbulence5Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
Weekly Cups (Sept 8-14): herO & MaxPax split cups3WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia7Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29LiuLi Cup - September 2025 Tournaments3
StarCraft 2
General
Team Liquid Map Contest #21 - Presented by Monster Energy #1: Maru - Greatest Players of All Time Weekly Cups (Sept 8-14): herO & MaxPax split cups SpeCial on The Tasteless Podcast Team TLMC #5 - Finalists & Open Tournaments
Tourneys
WardiTV TL Team Map Contest #5 Tournaments Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Diplomacy, Cosmonarchy Edition [ASL20] Ro16 Preview Pt2: Turbulence BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ ASL20 General Discussion
Tourneys
[ASL20] Ro16 Group C [IPSL] ISPL Season 1 Winter Qualis and Info! Is there English video for group selection for ASL [ASL20] Ro16 Group B
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile General RTS Discussion Thread Nintendo Switch Thread Borderlands 3
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread Russo-Ukrainian War Thread The Big Programming Thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1455 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
Spain18048 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
Poland17341 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
Spain18048 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
Poland17341 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
Spain18048 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
Poland17341 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
OSC
00:00
Mid Season Playoffs #2
CranKy Ducklings102
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 116
SpeCial 112
CosmosSc2 50
Vindicta 36
StarCraft: Brood War
Artosis 810
ggaemo 135
sSak 18
Icarus 5
Dota 2
NeuroSwarm168
Counter-Strike
fl0m1727
Stewie2K549
Other Games
summit1g5969
shahzam969
JimRising 486
C9.Mang0361
Day[9].tv313
SortOf158
Maynarde138
Trikslyr77
Nathanias30
RuFF_SC224
Organizations
Other Games
gamesdonequick1264
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• davetesta26
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Scarra1128
• Day9tv313
Upcoming Events
Sparkling Tuna Cup
8h 14m
Afreeca Starleague
8h 14m
Light vs Speed
Larva vs Soma
2v2
9h 14m
PiGosaur Monday
22h 14m
LiuLi Cup
1d 9h
RSL Revival
2 days
Maru vs Reynor
Cure vs TriGGeR
The PondCast
2 days
RSL Revival
3 days
Zoun vs Classic
Korean StarCraft League
4 days
BSL Open LAN 2025 - War…
4 days
[ Show More ]
RSL Revival
4 days
BSL Open LAN 2025 - War…
5 days
RSL Revival
5 days
Online Event
5 days
Wardi Open
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
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

Upcoming

2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
TLPD

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

Advertising | Privacy Policy | Terms Of Use | Contact Us

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