• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 12:02
CET 18:02
KST 02:02
  • 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
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets0$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)12Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822
StarCraft 2
General
When will we find out if there are more tournament SC2 Spotted on the EWC 2026 list? Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns Spontaneous hotkey change zerg
Tourneys
$25,000 Streamerzone StarCraft Pro Series announced $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) WardiTV Winter Cup WardiTV Mondays SC2 AI Tournament 2026
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
Potential ASL qualifier breakthroughs? A cwal.gg Extension - Easily keep track of anyone BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion StarCraft & BroodWar Campaign Speedrun Quest
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Beyond All Reason Nintendo Switch Thread Awesome Games Done Quick 2026! Mechabellum Stormgate/Frost Giant 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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1379 users

The Big Programming Thread - Page 943

Forum Index > General Forum
Post a Reply
Prev 1 941 942 943 944 945 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.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2018-02-02 17:06:34
February 02 2018 17:02 GMT
#18841
On February 03 2018 01:15 Silvanel wrote:
So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python).

I don't know much python, so I can't really tell you stuff that would be relevant for someone switching from python to C#. Most important advice though: Get Resharper, preferably ultimate, and learn a new resharper command every day/week. 100% worth it. If your company doesn't already use it, try to convice them. Even if it only increases productivity by 1% it's probably well worth the cost already. It also makes refactoring easier, thus improving code quality and maintainability. And working in VisualStudio just is so much better with it than without.

Also get comfortable with the linq namespace. So this:
from s in names 
where s.Length == 5
orderby s
select s.ToUpper();

and this:
names.Where(s => s.Length == 5).OrderBy(s => s).Select(s => s.ToUpper());

I prefer the latter version, though the difference is mostly aesthetical. Also Resharper can convert between the two versions with a few keypresses. Linq is one of the best parts of C# imo. To go with that, make sure you learn about and understand yield return and yield break.

C# is a nice language, but obviously not without issues. There are a few remnants of early versions of C# when it didn't support generics yet that still annoy me from time to time, but it rarely is a big deal. Also make sure you understand how events work with garbage collection, and read the msdn article on the disposable pattern. Otherwise you might run into a memory leak here and there.
If you have a good reason to disagree with the above, please tell me. Thank you.
sc-darkness
Profile Joined August 2017
856 Posts
February 02 2018 23:41 GMT
#18842
On February 03 2018 01:15 Silvanel wrote:
So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python).


Are you familiar with OOP, design patterns and collections (ADT)? If not, then I'd say this is more important than learning just C#. Once you know these topics, it doesn't matter if you use C#, Java, C++ or a similar language. The rest is just syntax and experience from my point of view.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 03 2018 14:24 GMT
#18843
On February 03 2018 02:02 spinesheath wrote:
Show nested quote +
On February 03 2018 01:15 Silvanel wrote:
So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python).

I don't know much python, so I can't really tell you stuff that would be relevant for someone switching from python to C#. Most important advice though: Get Resharper, preferably ultimate, and learn a new resharper command every day/week. 100% worth it. If your company doesn't already use it, try to convice them. Even if it only increases productivity by 1% it's probably well worth the cost already. It also makes refactoring easier, thus improving code quality and maintainability. And working in VisualStudio just is so much better with it than without.

Also get comfortable with the linq namespace. So this:
from s in names 
where s.Length == 5
orderby s
select s.ToUpper();

and this:
names.Where(s => s.Length == 5).OrderBy(s => s).Select(s => s.ToUpper());

I prefer the latter version, though the difference is mostly aesthetical. Also Resharper can convert between the two versions with a few keypresses. Linq is one of the best parts of C# imo. To go with that, make sure you learn about and understand yield return and yield break.

C# is a nice language, but obviously not without issues. There are a few remnants of early versions of C# when it didn't support generics yet that still annoy me from time to time, but it rarely is a big deal. Also make sure you understand how events work with garbage collection, and read the msdn article on the disposable pattern. Otherwise you might run into a memory leak here and there.

None of this is really relevant to a programmer new to C# that won't have much control over their environment.

My advice is to make a few quick scratch projects to get an idea of how it works in practice, tailored towards what you will be doing in the work place.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
mantequilla
Profile Blog Joined June 2012
Turkey781 Posts
February 03 2018 17:34 GMT
#18844
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.
Age of Mythology forever!
Acrofales
Profile Joined August 2010
Spain18180 Posts
Last Edited: 2018-02-03 18:44:35
February 03 2018 18:42 GMT
#18845
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
February 04 2018 09:36 GMT
#18846
On February 04 2018 03:42 Acrofales wrote:
Show nested quote +
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.


Until it teaches itself how to reprogram the reward...
TRUEESPORTS || your days as a respected member of team liquid are over
Acrofales
Profile Joined August 2010
Spain18180 Posts
February 04 2018 10:14 GMT
#18847
On February 04 2018 18:36 emperorchampion wrote:
Show nested quote +
On February 04 2018 03:42 Acrofales wrote:
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.


Until it teaches itself how to reprogram the reward...

Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
February 04 2018 11:01 GMT
#18848
On February 04 2018 19:14 Acrofales wrote:
Show nested quote +
On February 04 2018 18:36 emperorchampion wrote:
On February 04 2018 03:42 Acrofales wrote:
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.


Until it teaches itself how to reprogram the reward...

Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.


That’s exactly what an AI that could rewrite it self would say.
TRUEESPORTS || your days as a respected member of team liquid are over
mantequilla
Profile Blog Joined June 2012
Turkey781 Posts
February 04 2018 22:26 GMT
#18849
On February 04 2018 20:01 emperorchampion wrote:
Show nested quote +
On February 04 2018 19:14 Acrofales wrote:
On February 04 2018 18:36 emperorchampion wrote:
On February 04 2018 03:42 Acrofales wrote:
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.


Until it teaches itself how to reprogram the reward...

Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.


That’s exactly what an AI that could rewrite it self would say.


only a true scheming AI would make such an accusation...
Age of Mythology forever!
Mr. Wiggles
Profile Blog Joined August 2010
Canada5894 Posts
February 05 2018 05:36 GMT
#18850
It's still sort of fun to observe what kind of unexpected behaviour can arise from a given reward function, even if you believe it should be limiting the behaviour of the agent.

My favourite example was from a grad student's demonstration in a reinforcement learning course I was taking. He had a Roomba that was using an optical sensor (or something like that) to tell if it was on a black 'track' in a confined rectangle. The reward function was for rotating the wheels forward while over the black track, while being punished for moving when off it or going in reverse. The rotation of the wheels was meant to be an approximation of movement. The idea was for the agent to eventually learn how to continuously move along the track.

In some situations however, the Roomba could accidentally wedge itself into a corner with it's wheels suspended while remaining over the track. It would then begin maximizing its reward by spinning the wheels at top speed while they were suspended.

The recent discussion reminded me of this, and it seemed like a funny anecdote about an agent finding an unexpected (and degenerate) way of maximizing a reward function.
you gotta dance
Simberto
Profile Blog Joined July 2010
Germany11712 Posts
February 05 2018 08:56 GMT
#18851
On February 05 2018 14:36 Mr. Wiggles wrote:
It's still sort of fun to observe what kind of unexpected behaviour can arise from a given reward function, even if you believe it should be limiting the behaviour of the agent.

My favourite example was from a grad student's demonstration in a reinforcement learning course I was taking. He had a Roomba that was using an optical sensor (or something like that) to tell if it was on a black 'track' in a confined rectangle. The reward function was for rotating the wheels forward while over the black track, while being punished for moving when off it or going in reverse. The rotation of the wheels was meant to be an approximation of movement. The idea was for the agent to eventually learn how to continuously move along the track.

In some situations however, the Roomba could accidentally wedge itself into a corner with it's wheels suspended while remaining over the track. It would then begin maximizing its reward by spinning the wheels at top speed while they were suspended.

The recent discussion reminded me of this, and it seemed like a funny anecdote about an agent finding an unexpected (and degenerate) way of maximizing a reward function.


It is kind of funny and/or scary how much that sounds like a drug addict.
Silvanel
Profile Blog Joined March 2003
Poland4740 Posts
Last Edited: 2018-02-05 15:14:41
February 05 2018 09:03 GMT
#18852
The vocabulary itself (reward function, agent, reinforcment) is causing us to project our emotions on it and humanize it. They shouldnt be using terms taken from psychology.
Pathetic Greta hater.
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
February 05 2018 12:04 GMT
#18853
On February 05 2018 07:26 mantequilla wrote:
Show nested quote +
On February 04 2018 20:01 emperorchampion wrote:
On February 04 2018 19:14 Acrofales wrote:
On February 04 2018 18:36 emperorchampion wrote:
On February 04 2018 03:42 Acrofales wrote:
On February 04 2018 02:34 mantequilla wrote:
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?

like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.

Yes, it is.

Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.


Until it teaches itself how to reprogram the reward...

Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.


That’s exactly what an AI that could rewrite it self would say.


only a true scheming AI would make such an accusation...


(n)spooky(n+3)me
TRUEESPORTS || your days as a respected member of team liquid are over
Acrofales
Profile Joined August 2010
Spain18180 Posts
February 05 2018 13:36 GMT
#18854
On February 05 2018 18:03 Silvanel wrote:
The vocabulary itself (reward function, agent, reinforcment) is causing us to project our emetions on it and humanize it. They should be using terms taken from psychology.

What on earth do you mean?
Silvanel
Profile Blog Joined March 2003
Poland4740 Posts
Last Edited: 2018-02-05 15:14:23
February 05 2018 15:13 GMT
#18855
Should be obvious enough. Words have power. They define how we see world. If You take words normally aassiciated with human beings and use them on inanimate things it will cause people to project feelings onto them, humanise them. On the other hand when You use words normally assiaciated with inanimate obejcts on people You will help to dehumanise them and erode empathy.

Also i made mistake in my previous post i have writen "should" instead of "shouldnt".
Pathetic Greta hater.
Silvanel
Profile Blog Joined March 2003
Poland4740 Posts
Last Edited: 2018-02-05 15:13:46
February 05 2018 15:13 GMT
#18856
Double post.
Pathetic Greta hater.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 08 2018 01:18 GMT
#18857
My app has some DbAdapters and a Session to store the user's account.

Throughout my app I access the DB by creating a DB adapter, doing something with it, then closing it. I'm consider adding my DB adapters to either the Session or a separate object created at app startup to avoid having all that unnecessary code. Does this seem reasonable?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
February 08 2018 01:45 GMT
#18858
On February 08 2018 10:18 WarSame wrote:
My app has some DbAdapters and a Session to store the user's account.

Throughout my app I access the DB by creating a DB adapter, doing something with it, then closing it. I'm consider adding my DB adapters to either the Session or a separate object created at app startup to avoid having all that unnecessary code. Does this seem reasonable?

So what's the end goal of doing this? Because without more details, it sounds like you're trying to solve problems that aren't really problems.
Average means I'm better than half of you.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
February 08 2018 02:41 GMT
#18859
Well I figure if I can do this I can remove a substantial amount of code. Instead of opening, using, then closing the adapter I can just have it open the whole time, and use it when I want it. This means that I can make inline calls to the DB without either wrapping it in a pointless function or cluttering up my code. I'm wondering whether my proposal is bad design, though.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
February 08 2018 09:33 GMT
#18860
On February 08 2018 11:41 WarSame wrote:
Well I figure if I can do this I can remove a substantial amount of code. Instead of opening, using, then closing the adapter I can just have it open the whole time, and use it when I want it. This means that I can make inline calls to the DB without either wrapping it in a pointless function or cluttering up my code. I'm wondering whether my proposal is bad design, though.

If I recall, you've asked similar questions before, and the general theme seems to be that you're putting a lot of undue emphasis on "decluttering" your code. Clean code should come naturally no matter what you're programming, and hacking functionality together is the opposite of that.

Long-short, always close your DB adapters. There may be niche cases where you will want to leave a connection open, but you should be able to clearly say why that's necessary from a system perspective.

Also, when you say "without...wrapping it in a pointless function", I hope you're just wording that poorly, because encapsulation is a fundamental aspect of OOP.
Average means I'm better than half of you.
Prev 1 941 942 943 944 945 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Invitational
14:00
Group B
WardiTV1460
IndyStarCraft 208
Rex131
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 208
Rex 131
BRAT_OK 102
JuggernautJason58
MindelVK 27
SC2Nice 23
StarCraft: Brood War
Rain 9039
firebathero 256
Mong 89
Hyun 68
Pusan 63
Snow 52
Mind 51
soO 35
Aegong 27
scan(afreeca) 17
[ Show more ]
Yoon 16
GoRush 10
Sacsri 4
Dota 2
qojqva4422
syndereN665
Counter-Strike
byalli362
Other Games
Gorgc2984
Liquid`RaSZi1624
B2W.Neo1249
hiko862
crisheroes269
DeMusliM266
ArmadaUGS131
QueenE128
Fuzer 39
Mew2King36
Organizations
Other Games
gamesdonequick3957
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• TFBlade946
Upcoming Events
PiGosaur Cup
7h 58m
WardiTV Invitational
18h 58m
The PondCast
1d 16h
OSC
1d 18h
OSC
2 days
All Star Teams
3 days
INnoVation vs soO
sOs vs Scarlett
uThermal 2v2 Circuit
3 days
All Star Teams
4 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
4 days
OSC
4 days
[ Show More ]
Replay Cast
5 days
Wardi Open
5 days
Liquipedia Results

Completed

Proleague 2026-01-12
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
OSC Championship Season 13
Underdog Cup #3
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Thunderfire SC2 All-star 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
TLPD

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

Advertising | Privacy Policy | Terms Of Use | Contact Us

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