EDT 01:15 CEST 07:15 KST 14:15

Streams: 105 live
126447 total viewers

Active: 7054
Pizza Meter
[GSTL] Week 10 - Prime Tim…
[WCS KR] Innovation vs. Sy…
[WCS AM] Ro16 Group D Prev…
G-1 Champions League LAN F…
[WCS KR] Ro4 Preview / Cod…
[WCS EU] Grubby, MMA, Ret …
Pizza: All Tiers Reached
Vici and RisingStars Advan…
Up&Down groups for 2013 WC…
HerO, Revival Interviews -…
[SPL] Round 5 Week 4 Start…
viOLet forfeits WCS AM due…
Get 50% off Papa John's pi…
TL Advertising Features
I-5 Bridge Collapse (Mou…
GeoGuessr geography game
UK Soldier beheaded in L…
Fountain Pens
US Politics Megathread
Long Island, NY BarCraft!
Long Island SC Community
Seoul LoL allstars Meetup …
The Automated Ban List
Ask TL Staff Anything
The Liquid`HerO Fanclub!
The SeleCT Fanclub
Crayon ~ High Master
[Stream] OpTiKDream
Any fix for Twitch tv lag?
Windows 8...should I upgra…
"Display Driver has stoppe…
Buying a new Pc chair
Dota 2 Game client out of …
Youngest Grand Master pl…
Pizza: All Tiers Reached
[WCS EU] Grubby, MMA, Re…
WCS AM - Ro16 Interviews…
[Interview] Code S Ro4 D…
Twitch.tv needs to impro…
[GSTL] FXO vs. StarTale 20…
[Code S] Ro4 Day 2 WCS Kor…
ChoboTeamLeague - Season 4
[WCS AM] RO16 Group D Prem…
Atlanta $10 Buy in - Winne…
The HotS Protoss Help Me T…
ZvT 10minute hive fast ult…
[G] TheCore - Advanced Key…
[Q] Is Mech weaker then bi…
CatZ CC first counter - a …
[A] Starbow
Map Jam & Challenge #5
OneGoal: A better SC2 [Pro…
[D] Map Contest Finalists,…
Work In Progress Melee Maps
General Discussion
Dota2 Hero Spreadsheet
Bruno Community Q&A
G-1 Champions League LAN…
Who is Who
Dota 2 QQ thread
[G-1] LAN Finals
Perfect World's Dota 2 Su…
Dota 2 Canada Cup - Featur…
[The International] Easter…
MN Dota 2 Tournament
[G] In-Game Dota Guide for…
[H] Night Stalker
Simple Questions, Simple A…
[G] Clockwerk, The Offlani…
[G]uide to Lifestealer
[D] New BW Server
DES Sonic Interview 5/18…
2 Artificial Intelligenc…
Nada's Body
iCCup Area Bans? (why n…
[Update] itemBay SSL Gra…
Gem League II
D Ranks Teamleague Season 4
[GC S3] Gambit's Cup Semif…
C Ranks Teamleague Season 1
[SRT] Ro16 Group B
Increasing APM/EAPM
Practice Partner Thread
Challenger map on Starcraf…
Simple Questions, Simple A…
Fighting Games 2013 [FGC]
NBA Playoffs 2013
Super Street Fighter 4: …
FINALLY! - The 2013 NHL …
2012 - 2013 Football Thr…
[Patch 3.07: Nerf Everythi…
[HELP] i CAN'T play melee …
The LoCicero Memorial for …
[LCS] All-Star Tournament
[OGN] Olympus The Champion…
[LoL] General Stream Thread
[Champion] Cho'Gath
[Champion] Nidalee
[Champion] Nunu
The: What is my item worth?
Barbarian - Builds/Discuss…
[G] Hardcore
Les Mafia Voting Thread
Carnival Cruise Mafia
[M][N] Les Mafia
The 2013 Weightlifting Pro…
TL Health and Fitness Init…
The Injuries Thread
Leta - Movie
Michael - skyline
Anytime - Beast
By.Hero - Shuttle
Anytime - Pusan

Website Feedback

Closed Threads

IRC Chat
irc.quakenet.org #teamliquid

IRC Web Client

TeamSpeak 3 (94 users)

The Big Programming Thread - Page 102

Forum Index > General Forum 1 2 3 4 5 6 7 8 9 10 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 200 295 296 297 298 299 300 301 302 303 304 305
 
 Cambium   Japan. December 30 2011 04:37. Posts 15631
Profile Blog # 

On December 27 2011 23:48 kaihangkk wrote:
i know nth about programming....which language would be the best one to start with?

really hard to say, but i'd go with python
When you want something, all the universe conspires in helping you to achieve it.
Old Post

 
 Frigo   Hungary. December 30 2011 05:01. Posts 980
Profile # 

On December 27 2011 23:48 kaihangkk wrote:
i know nth about programming....which language would be the best one to start with?

Start with Java and be sure you understand what are you doing. Try to find some basic course on it.
http://www.fimfiction.net/user/Treasure_Chest
Old Post

 
 ObliviousNA   United States. December 30 2011 05:21. Posts 448
Profile # 

On December 27 2011 23:19 ArcticVanguard wrote:
Does anyone have any suggestions for a tutorial for learning GUI programming for Windows? Language is C++. I'm looking at Qt but I'm having trouble following some of them out there. The thing I've seen is that GUI programming on any platform is a nightmare, but surely there are SOME out there that I can use.


Idk if it's graphically powerful enough for your needs (there's a bit of overhead with buttons, etc) but you could look at WPF in VS2010 for any of the .Net languages. (Csharp, VB.net, etc)

I've been using it for a little while now, and I rather like it. The xaml visual editor is 50/50, but great for starting out and learning.
Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. In our lab, theory and practice are combined: nothing works and no one knows why.
Old Post

 
 DensitY   New Zealand. December 30 2011 05:36. Posts 72
Profile # 

On December 27 2011 23:19 ArcticVanguard wrote:
Does anyone have any suggestions for a tutorial for learning GUI programming for Windows? Language is C++. I'm looking at Qt but I'm having trouble following some of them out there. The thing I've seen is that GUI programming on any platform is a nightmare, but surely there are SOME out there that I can use.


I think everyone above me has suggested this in some shape or form.

Easiest way to build Windows applications is via the .NET framework (Windows.Forms) in VB,C# C++/CLI (Pick your poison).

wxWidgets, QT, MFC are all good frameworks (maybe not MFC....), but they all have a steeper learning curve initially.

I would recommend learning the base win32 API in the future (once you've mastered .NET and one of the other frameworks) so you understand what is happening underneath the above frameworks.
Old Post

 
 Loser777   December 31 2011 11:18. Posts 1838
Profile Blog # 
Learning C++ after Java:
What happens when an element of a dynamically allocated array is released/deleted in C++? Does that mean all of the remaining elements of the array are shifted down or does that have to be done manually?

i.e. if we had a five element array of integers theArray[5] such as...
34
42
57
64
89

and executed "delete theArray[1]"

does it become

34

42
57
64
89

or

34
57
64
89
Last edit: 2011-12-31 11:21:47
6581
Old Post

 
 heishe   Germany. December 31 2011 11:36. Posts 2132
Profile Blog # 

On December 31 2011 11:18 Loser777 wrote:
Learning C++ after Java:
What happens when an element of a dynamically allocated array is released/deleted in C++? Does that mean all of the remaining elements of the array are shifted down or does that have to be done manually?

i.e. if we had a five element array of integers theArray[5] such as...
34
42
57
64
89

and executed "delete theArray[1]"

does it become

34

42
57
64
89

or

34
57
64
89


The former. You have to do this manually. Also, if you manually move the things down, the array will still keep its maximum size, there will just be leftover elements at the end (probably old values since moving things down usually means copying).
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
Old Post

 
 MasterKush   United Kingdom. December 31 2011 12:39. Posts 568
Profile # 

On December 30 2011 04:31 Shruikan998 wrote:
If I am looking to get into web design, and aim primarily to be self taught... What is the best language for me to learn to do this with?


I think the obvious choice (if you have absolutely zero experience with programming/coding) would be HTML and CSS.
Once you're comfortable with those you can move onto a scripting language like JavaScript.
If you want to transition to server-side programming then you can't go wrong with PHP & MySQL.
"Because, maybe, unlike what every whining kid on the internet thinks, terran actually isn't the easiest race? Shocking, I know." - Liquid`Jinro
Old Post

 
 Millitron   United States. December 31 2011 14:06. Posts 1242
Profile Blog # 

On December 30 2011 03:16 enigmaticcam wrote:
Anyone here familiar with the Knapsack problem? http://en.wikipedia.org/wiki/Knapsack_problem

I'm playing this PvP game that's very similar. You have a battleship with x number of weapon slots, limited capacity, and a large assortment of different types of weapons to fill those slots with, all with varying stats (including weight). I'm trying to write a program that will take your captain's stats, the number of weapon slots you have available, the max capacity your ship can hold, and all the possible weapons you can equip, and find the combination of weapons with the highest damage output. You can't just equip the highest damage possible for your level, because you will use up all your weight capacity before you use up all your weapon slots.

Of the solutions to the knapsack problem, the 0-1 solution is the closest to what I need. The problem is I have an additional constraint of limited number of weapons I can use (as many as weapon slots I have), plus I'm having a hard time interpreting the formula and understanding exactly what it's doing. Anyone have any experience with this kind of dynamic programming who might be able to help me out? I just need a better explanation of the formula so I can know how to implement it in my code. Thanks!

Edit: I think I understand the logic of the formula, but I can't quite get when it actually returns a value. Based strictly on what is written there, it seems to me like it will never actually produce a value until it gets down to the first item, in which case it would just produce 0. At some point you've gotta say, "ok, we don't need to go any further, just return this item's damage value", but I don't see when that would happen.

Don't use a program for this.

If you've ever played an Elder Scrolls game, you've dealt with similar problems when looting dungeons. What you do is, you divide the item's value by its weight, and that tells you how valuable it is to steal. The higher the ratio, the better the item is to steal.

Do the same thing with your game. Divide damage by weight, for each weapon, and take them in order, so you take the ones with the highest ratio first.
Who called in the fleet?
Old Post

 
 Loser777   December 31 2011 16:42. Posts 1838
Profile Blog # 

On December 31 2011 11:36 heishe wrote:

Show nested quote +



The former. You have to do this manually. Also, if you manually move the things down, the array will still keep its maximum size, there will just be leftover elements at the end (probably old values since moving things down usually means copying).

Thanks... you helped me realize that the array wasn't even dynamically allocated, only the objects in the array of pointers were... took me about 3 hours to figure out while delete [] theArray; was causing everything to explode.
6581
Old Post

 
 Zeke50100   United States. January 01 2012 01:55. Posts 2179
Profile Blog # 

On December 31 2011 16:42 Loser777 wrote:

Show nested quote +


Thanks... you helped me realize that the array wasn't even dynamically allocated, only the objects in the array of pointers were... took me about 3 hours to figure out while delete [] theArray; was causing everything to explode.



Just as a note: int* theArray = new int[10] would create a dynamically allocated array of 10 ints (i.e., a pointer to an array of 10 ints). int* theArray[10] would create an array of 10 pointers to ints. The former requires the use of "delete[]" in order to free the memory allocated by the entire array. The latter requires "delete theArray[n]" in order to free the memory of a specific element. If you try using "delete[]" on the latter, problems will happen
Old Post

 
 heishe   Germany. January 01 2012 02:04. Posts 2132
Profile Blog # 

On December 31 2011 14:06 Millitron wrote:

Show nested quote +


Don't use a program for this.

If you've ever played an Elder Scrolls game, you've dealt with similar problems when looting dungeons. What you do is, you divide the item's value by its weight, and that tells you how valuable it is to steal. The higher the ratio, the better the item is to steal.

Do the same thing with your game. Divide damage by weight, for each weapon, and take them in order, so you take the ones with the highest ratio first.


This method doesn't nearly produce optimal results though. If it were that simple, the "knapsack problem" wouldn't exist.
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
Old Post

 
 ObliviousNA   United States. January 01 2012 03:55. Posts 448
Profile # 

On December 30 2011 03:16 enigmaticcam wrote:
Anyone here familiar with the Knapsack problem? http://en.wikipedia.org/wiki/Knapsack_problem

I'm playing this PvP game that's very similar. You have a battleship with x number of weapon slots, limited capacity, and a large assortment of different types of weapons to fill those slots with, all with varying stats (including weight). I'm trying to write a program that will take your captain's stats, the number of weapon slots you have available, the max capacity your ship can hold, and all the possible weapons you can equip, and find the combination of weapons with the highest damage output. You can't just equip the highest damage possible for your level, because you will use up all your weight capacity before you use up all your weapon slots.

Of the solutions to the knapsack problem, the 0-1 solution is the closest to what I need. The problem is I have an additional constraint of limited number of weapons I can use (as many as weapon slots I have), plus I'm having a hard time interpreting the formula and understanding exactly what it's doing. Anyone have any experience with this kind of dynamic programming who might be able to help me out? I just need a better explanation of the formula so I can know how to implement it in my code. Thanks!

Edit: I think I understand the logic of the formula, but I can't quite get when it actually returns a value. Based strictly on what is written there, it seems to me like it will never actually produce a value until it gets down to the first item, in which case it would just produce 0. At some point you've gotta say, "ok, we don't need to go any further, just return this item's damage value", but I don't see when that would happen.


It seems that since you're limited by number of slots AND weight, this is more complex than the simplified knapsack problem.

http://en.wikipedia.org/wiki/List_of_knapsack_problems#Multiple_constraints

There is no poly-time solution, or even a poly-time approximation. You're going to have to bruteforce this one. Depending on the number of weapons you have potentially per slot, this could get really slow really fast.

Quote:
"The 0-1 variant (for any fixed ) was shown to be NP-complete around 1980 and more strongly, has no FPTAS unless P=NP"

If there was a way you could use #slots OR weight as a constraint, I could help you out with pseudocode.


Edit: By bruteforce, I mean if you have N slots available and W different weapons that fit that type, you could find every combination of the W weapons where order doesn't matter. This would end up being:
N nCr W different combinations. (nCr is calculator symbol for statistical 'choose')

10 weapons, 4 slots, 210 combinations (10 choose 4)

Then, sum the weight of each and remove combinations that break the weight capacity.
Then your highest damage sum should be your optimal solution for that weapon type.

You can also optimize by removing weapons that are absolutely inferior. In database this is called the 'skyline query' (I believe its a similar concept at least). It will take O(n^2), but it would make your weapon algorithm run much faster. If any weapon is inferior both in damage (has <= damage) AND weight (has >= weight) to any other weapon, this weapon can be completely removed from the equation. If they are both equal, the weapon is a duplicate and one of them can be removed anyway.

All of this is still assuming your 0-1 condition, i.e. no duplicate weapons.
Last edit: 2012-01-01 04:13:11
Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. In our lab, theory and practice are combined: nothing works and no one knows why.
Old Post

 
 Craton   United States. January 01 2012 10:43. Posts 10181
Profile Blog # 
I'm trying to make a simple webpage that will automatically resize the embedded Own3D stream when the browser is resized. I basically reused what Own3D itself does (as well as trying what TL and CLGaming use for embedding), but none of the variants actually result in a stream being loaded. I can access the SWF in my browser (the one linked through SRC), but it just doesn't seem to want to load on the page. The entire browser page does seem to contain a flash object, just an empty one. I've been testing it by running the page locally. The jquery link is valid and script identical to the one used by Own3D's working implementation.

Any ideas what I'm doing wrong?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<title>Craton's Own3D Alarm Clock</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body style="margin:0px; padding:0px;">
<object width="768" height="432" id="object">
<param name="movie" value="http://www.own3d.tv/livestream/6416" />
<param name="allowscriptaccess" value="always" />
<param name="allowfullscreen" value="true" />
<param name="wmode" value="transparent" />
<embed id="embed" src="http://www.own3d.tv/livestream/6416" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="768" height="432" wmode="transparent"></embed>
</object>
<script>
$(window).resize(function() {
$('#object').attr("width",$(window).width());
$('#object').attr("height",$(window).height());
$('#embed').attr("width",$(window).width());
$('#embed').attr("height",$(window).height());
});
</script>
</body>
</html>
Last edit: 2012-01-01 10:43:34
jeongmal kkeutnangeongayo (mari eoptneyo) eonjena geuraetjyo || LoL 2350+ Jungler || KPop: http://cratonz.minus.com/uploads
Old Post

 
 CAPSLOCKLOL   United States. January 02 2012 12:14. Posts 122
Profile Blog # 
Hi guys I'm in an introductory java class (AP Computer Science A) and need some help. I was working on a program that imported information from a text file about hurricane data, applied it to arrays, and used the arrays to categorize the information and calculate some averages and such. At the end I had to write the statistics to an output file.

Well in BlueJ I got the right output whenever I compile the program, but when I write it to a file by replacing all the System.out.print w/ outFile.print I check the text file and the output is ALL messed up in note pad. Literally nothing is neatly organized and overall it looks like a clusterfuck! I have absolutely no idea what to do at this point. I have a feeling it might have something to do with my printf methods, but I don't understand why it would look normal when I compile it in BlueJ but look awful in notepad. I'll post any parts of program if needed.
Old Post

 
 MisterD   Germany. January 02 2012 12:17. Posts 1338
Profile Blog # 

On January 02 2012 12:14 CAPSLOCKLOL wrote:
Hi guys I'm in an introductory java class (AP Computer Science A) and need some help. I was working on a program that imported information from a text file about hurricane data, applied it to arrays, and used the arrays to categorize the information and calculate some averages and such. At the end I had to write the statistics to an output file.

Well in BlueJ I got the right output whenever I compile the program, but when I write it to a file by replacing all the System.out.print w/ outFile.print I check the text file and the output is ALL messed up in note pad. Literally nothing is neatly organized and overall it looks like a clusterfuck! I have absolutely no idea what to do at this point. I have a feeling it might have something to do with my printf methods, but I don't understand why it would look normal when I compile it in BlueJ but look awful in notepad. I'll post any parts of program if needed.

try opening it with a different editor. If your program writes unix line breaks (\n), the windows editor screws up because it doens't display those. The windows editor only displays windows style line breaks (\r\n).
Gold isn't everything in life... you need wood, too!
Old Post

 
 CAPSLOCKLOL   United States. January 02 2012 12:31. Posts 122
Profile Blog # 

On January 02 2012 12:17 MisterD wrote:

Show nested quote +


try opening it with a different editor. If your program writes unix line breaks (\n), the windows editor screws up because it doens't display those. The windows editor only displays windows style line breaks (\r\n).
Oh ok that's it then. I use a lot of \n in my code. Good to know what the issue is! Thanks for the quick reply! :D I find it odd my class would encourage the use of \n and not mention that issue when outputting data. Does windows editor accept System.out.println(); as it seems my only option is to go back and change all the \n to println();

EDIT: Decided to just go with \r\n and it worked beautifully. If my teacher gives me crap about not yet learning anything about \r I'll just go back and fix it whatever way she wants. Once again thanks for the help!
Last edit: 2012-01-02 12:34:21
Old Post

 
 GiygaS   Canada. January 02 2012 13:00. Posts 726
Profile Blog # 
Hello everyone, thanks again for that help on the picturebox problem I was having, I'm now done that project ^_^

Anyway, I want to start learning python, getting pygame and really focusing on that language and eventually getting in to ludum dare in April, and since I'm leaving the visual studio editor, I'm at a crossroads.

On one hand, I have Vim (I've found tutorials I understand more so than Emacs which is why I'm choosing this one), which is a lot more efficient and sort of a "for the long-term" kind of editor, where it will take me a while to get used to it, but once I do I'll be a lot more efficient. The only problem that comes up when I think of this is that I don't want to juggle learning a new fairly complex editor at the same time as learning a brand new language.

On the other hand, we have Eclipse with Pydev. This is basically the opposite, being that it'll be an editor that's fairly good for what it does, but lacks the complexity of Vim. This, balanced with that it would be far easier to learn than Vim, and it would be less juggling to do.

Any advice?
Last edit: 2012-01-02 13:01:04
My pencils are sharp enough. Even the dull ones will make a mark.
Old Post

 
 lolmlg   January 02 2012 13:15. Posts 474
Profile # 

On January 02 2012 13:00 GiygaS wrote:
On the other hand, we have Eclipse with Pydev. This is basically the opposite, being that it'll be an editor that's fairly good for what it does, but lacks the complexity of Vim.

Sorry, did you just say that Eclipse isn't complex enough for you? It's one of the most feature-rich, confusing, and poorly documented IDEs ever made. If there's something you can't do in Eclipse it's because the functionality has been hidden somewhere in a menu maze.
Old Post

 
 GiygaS   Canada. January 02 2012 13:35. Posts 726
Profile Blog # 

On January 02 2012 13:15 lolmlg wrote:

Show nested quote +


Sorry, did you just say that Eclipse isn't complex enough for you? It's one of the most feature-rich, confusing, and poorly documented IDEs ever made. If there's something you can't do in Eclipse it's because the functionality has been hidden somewhere in a menu maze.

Sorry, I should have replaced that with efficiency. I watched a video on Vim and it seems incredibly efficient, compared to something where everything is menu-driven like Eclipse. Eclipse would be a program that you COULD just start up with near minimal interaction with the complexities of it, just learn how to do certain hings (compile and run), and it's a go. Whereas with Vim I would almost feel obligated to learn intricacies of the editor.
My pencils are sharp enough. Even the dull ones will make a mark.
Old Post

 
 Vilonis   United States. January 02 2012 13:44. Posts 130
Profile # 
For everyone doing GUI stuff:

I haven't worked with it much, but Python has bindings to c++'s wxWidgets called wxPython. It has a pretty good abstraction and runs at about the speed of the c++ equivalent. Anyway, it is a just something I'm aware of that some of you may want to look into, especially if you love python, like I do.

GiygaS, Emacs is better.

Just kidding, I don't want to start one of those arguments. I simply tried each briefly and started to learn emacs and I love it, more than any IDE I have come across so far.

Edit: With respect to learning multiple things at once, I learned a new language and the Dvorak keyboard layout at the same time. It took some time but I can touch type now, and that is cool! So if you are up for the challenge of learning two different things at once, go for it.
Last edit: 2012-01-02 13:48:01
"Such is the vastness of his genius that he can outwit even himself!" - Iskaral Pust, High Priest of High House Shadow
Old Post

1 2 3 4 5 6 7 8 9 10 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 200 295 296 297 298 299 300 301 302 303 304 305
Please log in or register to reply.
 

» Recent SC2 Results
» Premier SC2 Tournaments
Sidebar Settings...

The Little App Factory



The opinions expressed by our users do not reflect the official position of TeamLiquid.net or its staff.

Advertising | Jobs | Privacy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren. Ad tag: TF_US.
The contents of this webpage are copyright © 2002-2013 Teamliquid.net. All Rights Reserved