• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:29
CET 16:29
KST 00:29
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation6Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
[TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t Weekly Cups (Nov 3-9): Clem Conquers in Canada Craziest Micro Moments Of All Time? SC: Evo Complete - Ranked Ladder OPEN ALPHA
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle Terran 1:35 12 Gas Optimization BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET [ASL20] Grand Finals [Megathread] Daily Proleagues
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
EVE Corporation Nintendo Switch Thread Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Path of Exile
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1229 users

The Big Programming Thread - Page 948

Forum Index > General Forum
Post a Reply
Prev 1 946 947 948 949 950 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.
Manit0u
Profile Blog Joined August 2004
Poland17429 Posts
Last Edited: 2018-02-24 14:37:00
February 24 2018 14:36 GMT
#18941
On February 23 2018 03:55 sabas123 wrote:
Show nested quote +
On February 22 2018 23:04 Excludos wrote:
So (I might have mentioned this earlier) our firm doesn't really have any testing policy. Our only testing is done in the form of manually checking that shit works after coding. While this will work to some extent, it's not a super good practice.

So one of my colleagues came up with the idea to run a workshop with everyone to teach people how to set up proper tests and to apply some good practices. The conversation with the boss went as follows:

"No".
"Why not?"
"We don't have time right now".
"When will we have time for this?"
"Well everything is a bit unstable at the moment. If we get everything more stable then we'll have ti-" "DO YOU NOT SEE THE PROBLEM HERE?!"

Aaaahhh, I remember having a similar conversation once. Good times....


Haha, I remember stuff like that too in one of the companies I was working at.

"Hey boss, you know this 10 years old system that we have to maintain and it's a complete nightmare?"
"Sure, what of it?"
"Well, we did gather all the guys and debated about rewriting it in new technologies to clean up the code, get rid of technical debt and make adding new features significantly easier"
"How long would it take?"
"We could do it in about 6 months"
"No way! Instead of doing that focus on adding this new little feature"

Adding new feature took us 7 months (it was something that shouldn't really take more than a week or two). Technical debt is a bitch.
Time is precious. Waste it wisely.
Hanh
Profile Joined June 2016
146 Posts
February 25 2018 12:06 GMT
#18942
Well, when developers say they can do something in 6 months it usually takes more than a year in the end...
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 26 2018 06:33 GMT
#18943
Are any of you familiar with generators/co-routines? I don't have a full picture of what is going on here, and I am wondering if my intuition about them is correct.

If I am DFS traversing a graph with a generator, can I pause the generator and add edges to the graph and then continue the generator, thus increasing my efficiency vs adding edges and starting DFS traversal all over?
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
February 26 2018 07:46 GMT
#18944
On February 26 2018 15:33 travis wrote:
Are any of you familiar with generators/co-routines? I don't have a full picture of what is going on here, and I am wondering if my intuition about them is correct.

If I am DFS traversing a graph with a generator, can I pause the generator and add edges to the graph and then continue the generator, thus increasing my efficiency vs adding edges and starting DFS traversal all over?

Not entirely familiar with the "generator" part. Is that like creating a representation of the node structure or something?

But, I don't particularly see a reason why you couldn't add edge nodes while traversing. Have your conditions built into the DFS, and then make sure to include the new nodes in the search after creating them.

It would be slower than a straight DFS, though, if that's a problem with efficiency.
Average means I'm better than half of you.
Acrofales
Profile Joined August 2010
Spain18114 Posts
February 26 2018 09:48 GMT
#18945
On February 26 2018 15:33 travis wrote:
Are any of you familiar with generators/co-routines? I don't have a full picture of what is going on here, and I am wondering if my intuition about them is correct.

If I am DFS traversing a graph with a generator, can I pause the generator and add edges to the graph and then continue the generator, thus increasing my efficiency vs adding edges and starting DFS traversal all over?

What do you mean "pause" the generator? I am assuming with generator you mean python generators. If there are other types of generators that work differently, then this obviously doesn't apply.

In the case of pythonic generators, there *shouldn't* be a problem (obviously depends on how you implement your generator), but for any algorithm looping over the generator, this *might* cause unexpected behaviour. The first thing is that you don't pause (or run, for that matter) a generator. You usually loop over it, but there are other ways of calling it (such as calling list() on a generator, which internally works out to about the same as doing [x for x in generator], although I'm not sure whether it is coded like that).

Either way, a generator is built with a function that instead of returning a result, it "yields" a result. How you define that function is up to you. If your function is required to know the entire structure of the tree in order to yield nodes, then it will break if you add nodes or edges. If, however, it simply runs the DFS algorithm in each node and yields the next one, then it will not care that you add edges. I don't think you can remove edges without breaking it, though. Adding nodes will lead to these nodes not being iterated over if you don't add edges to unvisited nodes. Moreover, if what you do in your algorithm depends in any way upon the number of edges there, then adding (or removing) edges will lead to incorrect results if you change the structure while running it.
Hanh
Profile Joined June 2016
146 Posts
Last Edited: 2018-02-26 12:22:31
February 26 2018 12:22 GMT
#18946
On February 26 2018 15:33 travis wrote:
Are any of you familiar with generators/co-routines? I don't have a full picture of what is going on here, and I am wondering if my intuition about them is correct.

If I am DFS traversing a graph with a generator, can I pause the generator and add edges to the graph and then continue the generator, thus increasing my efficiency vs adding edges and starting DFS traversal all over?


Yes, but it will be better to use an non-recursive DFS (preferably the non-stack version) as it will run much faster and you will have better control of the logic.
Programmer2
Profile Joined November 2017
9 Posts
February 27 2018 20:51 GMT
#18947
in Unity, is it possible to select an object that I custom made, drag the outer edge or the corners with my mouse to make it longer or taller? If it is, what would the code look like in C*? It would be very helpful as I make my game.

Also does Unity come with its own platform objects of various shapes and sizes or do I need to make my own and do all the coding myself like not be able to pass through a platform etc...
Excludos
Profile Blog Joined April 2010
Norway8158 Posts
February 27 2018 22:14 GMT
#18948
On February 28 2018 05:51 Programmer2 wrote:
in Unity, is it possible to select an object that I custom made, drag the outer edge or the corners with my mouse to make it longer or taller? If it is, what would the code look like in C*? It would be very helpful as I make my game.


Yes, this should easily be possible. You need to capture the mouse position on the edge and if clicked -> object.transform depending on how far it moves from its original target. I'm unsure on the exact implementation of this


Also does Unity come with its own platform objects of various shapes and sizes or do I need to make my own and do all the coding myself like not be able to pass through a platform etc...


I genuinely have no idea what you're asking here.

I'm sure there's other people here who's dabbled with unity, but Unity already has a gigantic community with guides, forums, chats, videos, examples, etc etc. I'm sure you'll have a lot more luck if you look around a little bit or ask there
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
Last Edited: 2018-02-27 22:53:29
February 27 2018 22:52 GMT
#18949
I think he's asking if Unity has a built in engine for collision detection. Don't know that myself.
Average means I'm better than half of you.
Excludos
Profile Blog Joined April 2010
Norway8158 Posts
Last Edited: 2018-02-28 08:15:11
February 28 2018 08:13 GMT
#18950
On February 28 2018 07:52 WolfintheSheep wrote:
I think he's asking if Unity has a built in engine for collision detection. Don't know that myself.


That's a weird question tho considering collision detection is one of the main components of Unity..

Again though I should emphasize that if one wants to learn Unity, there are hundreds of guides on how to get started. Look around on the "learn" tab on Unity's own website https://unity3d.com/learn for instance. The "roll a ball" tutorial is a really good way to get started. I'm unsure about the interactive tutorials as I haven't tried any of them myself, but that sounds like a good idea too! Unity is perhaps the least complicated engine to make anything in, but that doesn't mean you can just jump into it and expect to immediately understand how it works.
Manit0u
Profile Blog Joined August 2004
Poland17429 Posts
Last Edited: 2018-02-28 14:55:18
February 28 2018 14:45 GMT
#18951
So, let me get back at you with regexes...


/\A(?!(?:com[0-9]|lpt[0-9]|con|nul|prn|aux)(?:\.[^.]*)?$)([w \-.()+]+[w \-.()+])(?<!\.)\Z/i


How can I avoid catastrophic backtracking with long strings (40+ characters) where failing condition appears near/at the end of the string? Trying to test such strings on my dev machine (Core i7 with 12GB of RAM) kills the machine...

I guess I could potentially split it into 3 separate regexes and check each one at a time.

Edit:

Interesting read on the topic: http://www.rexegg.com/regex-explosive-quantifiers.html
Time is precious. Waste it wisely.
tofucake
Profile Blog Joined October 2009
Hyrule19151 Posts
Last Edited: 2018-02-28 15:26:25
February 28 2018 15:24 GMT
#18952
what happens if you switch it around and use a negative match instead of negative lookahead (or positive lookbehind)?
Liquipediaasante sana squash banana
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
February 28 2018 17:11 GMT
#18953
Are you sure Regex is the right tool for the job?
If you have a good reason to disagree with the above, please tell me. Thank you.
Excludos
Profile Blog Joined April 2010
Norway8158 Posts
February 28 2018 21:28 GMT
#18954
That is one hell of a regexp.. How long did that take you to churn out? O.o
TMG26
Profile Joined July 2012
Portugal2017 Posts
Last Edited: 2018-02-28 21:56:56
February 28 2018 21:54 GMT
#18955
Just recomended a overkill tool for the job. Plz ignore.
Supporter of the situational Blink Dagger on Storm.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
March 01 2018 06:37 GMT
#18956
I have a P/NP question.

I have read that were any NP problem be found to have a polynomial time algorithm, then we can reduce any other NP problem to a form where we can use our first algorithm to solve the new NP problem in polynomial time as well.


I don't see why this is the case.

Example: Hamiltonian Cycle problem, and Traveling salesman.

Were I to find a polynomial time algorithm to determine the existence of a hamiltonian cycle in a graph, I still don't see how this could let me find a TSP tour in an upper bound of polynomial time. The amount of subgraphs we would have to iteratively check for a hamiltonian cycle is often exponential.
Acrofales
Profile Joined August 2010
Spain18114 Posts
March 01 2018 07:06 GMT
#18957
On March 01 2018 15:37 travis wrote:
I have a P/NP question.

I have read that were any NP problem be found to have a polynomial time algorithm, then we can reduce any other NP problem to a form where we can use our first algorithm to solve the new NP problem in polynomial time as well.


I don't see why this is the case.

Example: Hamiltonian Cycle problem, and Traveling salesman.

Were I to find a polynomial time algorithm to determine the existence of a hamiltonian cycle in a graph, I still don't see how this could let me find a TSP tour in an upper bound of polynomial time. The amount of subgraphs we would have to iteratively check for a hamiltonian cycle is often exponential.

TSP isn't NP-complete. At least not the most common way of defining it (shortest path). To make it NP-complete, you'd have to ask a different question: is there a route that visits all cities exactly once with distance L or less? This check can be done in polynomial time, so this question is NP-complete.

Now I'm not sure how this would get reduced to the Hamilton cycles problem, but given that it's np complete, I'll assume there's a way to take a polynomial time algorithm and an oracle that solves the Hamiltonian cycles problem, and gives you the answer to the above question. And that doesn't mean you can solve the NP-hard problem of finding the shortest path that visits all cities exactly once with that same algorithm, because this subtly different question is far harder.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
March 01 2018 07:29 GMT
#18958
Ah right, I see.
Manit0u
Profile Blog Joined August 2004
Poland17429 Posts
Last Edited: 2018-03-01 10:46:56
March 01 2018 10:45 GMT
#18959
On March 01 2018 06:28 Excludos wrote:
That is one hell of a regexp.. How long did that take you to churn out? O.o


Took me a day or two. It's a regexp that checks if filename will be valid on Windows. We are using it in our model validators and thankfully we haven't run into catastrophic backtracing yet but that's only thanks to other validations failing before reaching this one.

If anyone needs cool regexes I have more of them


VALID_FILENAME = %r{\A(?!(?:com[0-9]|lpt[0-9]|con|nul|prn|aux)(?:\.[^.]*)?$)([w \-.()+]+[w \-.()+])(?<!\.)\Z}i
VALID_PATH = %r{\A(?:[^\/:*?"<>|\r\n\t\f\v]*\/?)+\Z}i
DNS_COMPLIANT_NAME = %r{\A(?![-.])(?!.*\.\.)[a-z0-9\-.]{3,63}(?<![-.])\Z}
VALID_IP_ADDRESS = %r{\A(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\Z}
Time is precious. Waste it wisely.
mahrgell
Profile Blog Joined December 2009
Germany3943 Posts
March 01 2018 11:29 GMT
#18960
Question is, if only because a regexp exists, it also should be used...

That's pretty much like the fabled "^.?$|^(..+?)\1+$". (checks if a number is non-prime) And I have seen people seriously use that one, because "look, how cool it is, I have a prime check in only one line!!! This must be the most efficient thing ever". Hint: It isn't.

But hey, only because Mythbusters have proven that duct tape is all you will ever need to survive any kind of situation, it doesn't mean you should sell all your belongings and invest it all into duct tape.
Prev 1 946 947 948 949 950 1032 Next
Please log in or register to reply.
Live Events Refresh
OSC
11:30
Mid Season Playoffs
Krystianer vs PercivalLIVE!
WardiTV1063
TKL 199
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 199
SteadfastSC 109
Rex 91
StarCraft: Brood War
Calm 3367
Bisu 2918
Rain 2430
Hyuk 1473
Horang2 984
Flash 514
Soma 498
Stork 393
Rush 303
Soulkey 121
[ Show more ]
Backho 114
Barracks 58
sas.Sziky 46
hero 38
Aegong 27
zelot 22
sSak 21
Terrorterran 20
Rock 19
Killer 16
Dota 2
Gorgc3152
qojqva2018
Dendi1105
BananaSlamJamma123
XcaliburYe100
Other Games
hiko638
Sick526
DeMusliM442
Hui .346
Fuzer 199
Mew2King94
QueenE50
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 9
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• poizon28 22
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 10
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 3021
• WagamamaTV453
League of Legends
• Nemesis4037
• TFBlade977
Upcoming Events
Tenacious Turtle Tussle
7h 32m
The PondCast
18h 32m
RSL Revival
18h 32m
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
20h 32m
WardiTV Korean Royale
20h 32m
PiGosaur Monday
1d 9h
RSL Revival
1d 18h
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
1d 20h
CranKy Ducklings
2 days
RSL Revival
2 days
herO vs Gerald
ByuN vs SHIN
[ Show More ]
Kung Fu Cup
2 days
IPSL
3 days
ZZZero vs rasowy
Napoleon vs KameZerg
BSL 21
3 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
3 days
RSL Revival
3 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
3 days
WardiTV Korean Royale
3 days
BSL 21
4 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
4 days
Dewalt vs WolFix
eOnzErG vs Bonyth
Wardi Open
4 days
Monday Night Weeklies
5 days
WardiTV Korean Royale
5 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 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.