• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:45
CEST 10:45
KST 17:45
  • 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 #22 - Voting & Ladder Map Selection1Code S Season 2 (2026) - RO8 Preview4[ASL21] Finals Preview: Two Legacies21Code S Season 2 (2026) - RO12 Preview2herO wins GSL Code S Season 1 (2026)7
Community News
StarCraft II 5.0.16 PTR Patch Notes may 26th107Weekly Cups (May 18-25): MaxPax wins doubles0Crank Gathers Season 4: BW vs SC2 Team League4Weekly Cups (May 11-17): Classic wins double1Code S Season 1 (2026) - RO8 Results2
StarCraft 2
General
The death of cheese, from a professional cheeser. TL Poll: How do you feel about the 5.0.16 PTR balance changes? StarCraft II 5.0.16 PTR Patch Notes may 26th Changing from 12 to 8 is just asking for StarCraft Weekly Cups (May 11-17): Classic wins double
Tourneys
RSL Revival: Season 5 - Qualifiers and Main Event GSL Code S Season 2 (2026) Maestros of The Game 2 announcement and schedule ! Sparkling Tuna Cup - Weekly Open Tournament Crank Gathers Season 4: BW vs SC2 Team League
Strategy
[G] Having the right mentality to improve
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
The PondCast: SC2 News & Results Mutation # 528 Infection Detected Welcome to the External Content forum Mutation # 527 Hell Train
Brood War
General
Soma's ASL Finals Review BGH Auto Balance -> http://bghmmr.eu/ FlaShFTW vs A.Alm Grudge Match Event VPN experiences OGN to release AI-upscaled StarLeague from Feb 24
Tourneys
[ASL21] Grand Finals [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 [BSL22] WB Final & LB Semis - Saturday 21:00 CEST
Strategy
Any training maps people recommend? Muta micro map competition [G] Hydra ZvZ: An Introduction Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Path of Exile Dawn of War IV
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 TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Trading/Investing Thread Things Aren’t Peaceful in Palestine Dating: How's your luck?
Fan Clubs
The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books
Sports
McBoner: A hockey love story 2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Esportsmanship: How to NOT B…
TrAiDoS
Why RTS gamers make better f…
gosubay
ramps on octagon
StaticNine
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2637 users

The Big Programming Thread - Page 20

Forum Index > General Forum
Post a Reply
Prev 1 18 19 20 21 22 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.
Yukidasu
Profile Blog Joined September 2009
Australia125 Posts
August 11 2010 15:44 GMT
#381
I'd suggest making an empty map with only two bases (no cliffs, obstacles), and making it zergling rush or something. The trick to making it simple is to avoid situations where you'd need to make difficult decisions depending on what you see (like stay or run based on units seen and positioning), which are compounded by having lots of different unit types and longer games where you need to recognize more enemy things.

A simple speed zergling rush with a-move should work decently for the amount of effort needed, and then you can add intelligent stuff if you have time.
Lost in a groundless dream. You can't fly if there's nowhere to fall.
Badjas
Profile Blog Joined October 2008
Netherlands2038 Posts
August 11 2010 16:27 GMT
#382
I think you can get a bit more advanced than executing a zergling rush. A zergling rush involves only harvesting, growing overlords, zerglings and drones, a spawning pool and an extractor, with a very basic army control. Rather than demonstrating that you can win with an AI bot, I think it is much more useful in terms of an AI class that you demonstrate:
- Intelligent building placement
- Supporting a concept of build order (alternatively, have the build order be complete deduced but that's rather hard)
- Intelligent army composition and placement
- Scouting

Most of the logic needed has a spatial aspect to it.
Building placement logic depends on race played. The penalty for expanding building space for zerg is the greatest so there the focus will be on a tight defense/simcity. Terran on the other hand has a higher priority in placing buildings for a smart greater range of vision around the base, although of course balanced with a good simcity to protect key buildings and workers.

Intelligent army composition. Here some statistics of the game must be taken in to account, like which unit does what damage to what unit and some soft factors for mobility and build time perhaps. Based on the information that you got, and how much one can afford to keep on going with a certain plan or deviate, build units.

Those units must be placed on the map somewhere, which is a separate problem. If you have a logic that gives you the best army composition, then that logic will overlap somewhat in functional appearance as to how to place those units then. Ideally you'd want some soft squishy logic figure everything out, like distance from ramps to make, and if making a concave is smart and such. In terms of an AI class, you can go for that. In terms of making a successful AI, better hardcode this stuff because you ain't gonna peg this one (okay okay, I am making premature assumptions here).

Scouting involves spatial discovery with a risk/reward evaluation. Since reward evaluation will be insanely hard (depending also on how the build order is executed as well as decision making for army composition later on) it makes sense to link the amount of risk you're willing to take inversely with the time that the game is playing. BWAPI should, perhaps with a support library, give you a map with the general map structure and starting locations. Luxuries that regular players have as well, which are free for your exploitation.

Now if you want to make a very dynamic and soft coded AI bot that does anything good, 11 to 12 weeks isn't going to scratch the surface of that. My approach would be to get the most rudimentary thing running in every department, like what would be needed for the zergling rush and then capitalize on one or perhaps two segments as far as you think you can make it. If you have to write a plan beforehand on what you plan to finish, then that's a bit tough to determine beforehand so I guess better be safe than sorry on your promises. One thing to note, if you start out with the zergling rush, an obvious expansion would be the execution of more complex build orders. Preferably with soft logic in the sense that you can evaluate the benefits of saving up minerals for building a structure sooner rather than later in a point system comparable to the otherwise good sides of having a stronger economy from building more workers, and things like that.

I have not played around with BWAPI, I have seen some nice projects coming along for it though. Most of them initially dealt with unit micro, which is another area that can be interesting but most of the benefits came from abusing the insane APM a computer can wrench from the cpu. I'd suggest you contact those who've played with BWAPI before for more info, obviously.
I <3 the internet, I <3 you
stafu
Profile Blog Joined January 2009
Australia1196 Posts
August 11 2010 16:54 GMT
#383
Thanks Badjas, that's insanely helpful : ) I had thought about just making a standard rushing AI to demonstrate "look! it beats the computer!", but I would much prefer to do something a bit more macro and decision-making oriented. I guess that'll depend on how much time I have available for it, but you're right, starting with a rush is probably going to be the best way to get used to BWAPI and get a feel for what I can do. I'm pretty set on basing it solely on Terran, just because it's going to make building placement a bit simpler, as well as a pretty straightforward macro mechanic and some well-rounded simple unit compositions.

Again, thank you. Awesome post : ) I'll have to post my results on TL (as long as it's not [too much of] a failure :p)
Dave[9]
Profile Blog Joined October 2003
United States2365 Posts
August 12 2010 04:02 GMT
#384
So i've got an excel question.

I've got a set amount of data in an excel sheet that I would like to create possibly either a VBA program or C++ program that would as you questions, and then fill out that information accordingly in the spreadsheet in the correct rows. Is this possible? I know that it is possible to create surveys and whatnot with excel, but how can I.."tell the survey to record the results in a spreadsheet?" There will be some other issues as well, say in the program I ask "Is your major math?", select yes, but in that I have to put in the names of the classes I am taking, which means for one row, I would have to have split cells along the way to accomodate them being organized under "math major". I have a feeling if I can get some help in knowing how to create this kind of survey or program to fill information in a spreadsheet.

Say my survey goes as this(it's not really going to be used as a survey, but it will act like one, the purpose is the same.).

1. What is your class number? [user enters class number]
2. Are you a Math Major? [User selects yes or no]
3. How many classes are you taking? [number that tells you how many cells to create to fill in each one for each class, this is where the splitting cells in a row and whatnot comes in]
4. What classes are you taking? [User enters data that will fill in the data accordingly]

Can anyone show me a demo of this to expand on?
http://www.teamliquid.net/forum/viewmessage.php?topic_id=104154&currentpage=316#6317
AssuredVacancy
Profile Blog Joined September 2008
United States1167 Posts
August 12 2010 04:58 GMT
#385
On August 12 2010 13:02 Dave[9] wrote:
So i've got an excel question.

I've got a set amount of data in an excel sheet that I would like to create possibly either a VBA program or C++ program that would as you questions, and then fill out that information accordingly in the spreadsheet in the correct rows. Is this possible? I know that it is possible to create surveys and whatnot with excel, but how can I.."tell the survey to record the results in a spreadsheet?" There will be some other issues as well, say in the program I ask "Is your major math?", select yes, but in that I have to put in the names of the classes I am taking, which means for one row, I would have to have split cells along the way to accomodate them being organized under "math major". I have a feeling if I can get some help in knowing how to create this kind of survey or program to fill information in a spreadsheet.

Say my survey goes as this(it's not really going to be used as a survey, but it will act like one, the purpose is the same.).

1. What is your class number? [user enters class number]
2. Are you a Math Major? [User selects yes or no]
3. How many classes are you taking? [number that tells you how many cells to create to fill in each one for each class, this is where the splitting cells in a row and whatnot comes in]
4. What classes are you taking? [User enters data that will fill in the data accordingly]

Can anyone show me a demo of this to expand on?


I'm sure there are online questionnaire creators that you can use? Otherwise I don't think excel is the best tool to make this in
We spend our youth attaining wealth, and our wealth attaining youth.
catamorphist
Profile Joined May 2010
United States297 Posts
August 12 2010 05:13 GMT
#386
The demo is called Google Docs.

http://googledocs.blogspot.com/2008/02/stop-sharing-spreadsheets-start.html
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Loser777
Profile Blog Joined January 2008
1931 Posts
August 12 2010 05:33 GMT
#387
On August 11 2010 09:54 dvide wrote:
There are several problems here. Your use of fstream::eof() is flawed. See here for why:
http://stackoverflow.com/questions/1039667/why-does-stdfstream-set-the-eof-bit-the-way-it-does
http://stackoverflow.com/questions/730910/ifstream-object-eof-not-working

Secondly you should probably use: std::vector<BankAccount*> bankAccounts;

This will save you a lot of trouble. It uses a dynamic array internally, meaning you can insert any number of elements into the vector (using the push_back member function) and it will resize itself automatically at runtime to fit. In your case, if there is not exactly 10 bank accounts stored inside your file then there will be a problem here. For example, if there are 11 bank accounts in the file then your code will insert the last one into the 11th element of the array, which is undefined behaviour.

If there are less than 10 bank accounts stored inside your file, during clean-up you will be deleting a bank account that was never created. You will be calling delete on an uninitialised pointer, which again is undefined behaviour. You could initialise all bankAccount elements to NULL before you read the file, in which case your code would be fine so long as there are always <= 10 bank accounts in your file. Calling the delete operator on a NULL pointer is safe.

But again a normal C++ programmer wouldn't do it this way. Infact, a normal C++ wouldn't even use std::vector if they were able. They would rather use something like Boost's ptr_vector for this task, which is a class that owns the pointers internally and handles clean-up for you in its destructor (a popular C++ idiom called RAII, if you're interested). It also provides a nicer interface to your elements than an std::vector of pointers. This is probably not something you should focus on though until you are comfortable with what is actually going on. But just know that it's not always this difficult in C++ once you start using the proper tools for the job at hand


EDIT: How a C++ programmer would write this: http://codepad.org/Qs7nNq3R

Also, if you don't want to use stringstream I would recommend sscanf instead of atoi. At least that way you can check for formatting errors properly. atoi simply returns 0 on error, so if 0 is a valid value you won't know if it's a true error or not. However, when you gain more knowledge, you should be aware of the security problems with scanf (namely buffer overflows).

Hope this helps

Thanks! I'll try to digest some of that... in Java I at least got to use ArrayLists... I guess Vectors are an analog to ArrayLists
6581
Dave[9]
Profile Blog Joined October 2003
United States2365 Posts
August 12 2010 05:33 GMT
#388
On August 12 2010 14:13 catamorphist wrote:
The demo is called Google Docs.

http://googledocs.blogspot.com/2008/02/stop-sharing-spreadsheets-start.html


Almost, but it isn't quite what I want. Google Docs will display what I want in a spreadsheet, but the format is not of what I need it to be in.

What I basically want is a form like google docs that will fill in cells of a preexisting worksheet.
http://www.teamliquid.net/forum/viewmessage.php?topic_id=104154&currentpage=316#6317
Craton
Profile Blog Joined December 2009
United States17284 Posts
August 12 2010 05:46 GMT
#389
A cursory glance at Google shows that there exists ArrayLists for java (I'm pretty sure I've used them in the past), but Vectors perform a similar role.

If you use anything that is synchronized, you need to do so with the
utmost care or it will come back and bite you at some inopportune time
later. Vector, as an example, is prone to deadlock in some rather
trivial two-thread use cases in which an unsynchronized ArrayList
would perform perfectly.

If you do not desperately _need_ a synchronized list, you should
always go for an unsynchronized ArrayList. If you do need one that is
synchronized, you may want to used a Collections.synchronizedList()
although on 1.4.2 that synchronization seems slightly buggy (not sure
if it's fixed in 5.0). Vector might be more functional.
twitch.tv/cratonz
dnosrc
Profile Joined May 2009
Germany454 Posts
August 12 2010 18:46 GMT
#390
Thanks to this thread for showing me ProjectEuler. I am at 201/299 now :D

If anyone needs help or wants to work with me on the harder ones just pm.
Frigo
Profile Joined August 2009
Hungary1023 Posts
Last Edited: 2010-09-10 09:08:40
September 10 2010 09:08 GMT
#391
Whoever tries to solve problem 272 of PE, don't forget the 9, or you shall suffer for days.
http://www.fimfiction.net/user/Treasure_Chest
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
September 23 2010 16:01 GMT
#392
Question time! I have no idea how to google for this one, so here goes:

int a = 1 ? 2 : 3

What does it do? Or what is it called so I can google it up.
Kentor *
Profile Blog Joined December 2007
United States5784 Posts
Last Edited: 2010-09-23 16:09:54
September 23 2010 16:09 GMT
#393
On September 24 2010 01:01 Adeny wrote:
Question time! I have no idea how to google for this one, so here goes:

int a = 1 ? 2 : 3

What does it do? Or what is it called so I can google it up.

http://en.wikipedia.org/wiki/?:

or search ternary operator. basically a shorthand for an if else.
haduken
Profile Blog Joined April 2003
Australia8267 Posts
September 23 2010 16:11 GMT
#394
I *think* that is a short hand C statement.

It's equivalent to

if(1==true)
{2}
else
{3}

Correct me if I'm wrong. Its being a while.
Rillanon.au
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
September 23 2010 16:41 GMT
#395
Gotcha, thanks. TL to the rescue!
Frigo
Profile Joined August 2009
Hungary1023 Posts
Last Edited: 2010-09-23 17:28:32
September 23 2010 17:27 GMT
#396
No, it's not equivalent, but very close. It's basically a conditional assignment.
a = b ? c : d; is the same as
if( b )
a = c;
else
a = d;

http://www.fimfiction.net/user/Treasure_Chest
tofucake
Profile Blog Joined October 2009
Hyrule19215 Posts
September 23 2010 17:42 GMT
#397
On September 24 2010 01:01 Adeny wrote:
Question time! I have no idea how to google for this one, so here goes:

int a = 1 ? 2 : 3

What does it do? Or what is it called so I can google it up.

That particular instance is the same as int a = 2, although Frigo has it spot on:


On September 24 2010 02:27 Frigo wrote:
No, it's not equivalent, but very close. It's basically a conditional assignment.
a = b ? c : d; is the same as
if( b )
a = c;
else
a = d;


Liquipediaasante sana squash banana
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
Last Edited: 2010-09-23 21:26:32
September 23 2010 18:49 GMT
#398
+ Show Spoiler +
Not in C# it isn't! (I think, because 1 doesn't == true in C# if that's what you're refering to). Anyways the numbers were just examples. Now, onwards, to another question! Using C# btw.

So I've got a LAMP set up on VMware, which I want my .net app to communicate to, so far so good. Now, my choices are OleDB, ODBC or NET connector, fair enough. I went ahead and picked OleDB because frankly it was the first result in google, and this tutorial I found seems reasonable. So I guess my question is wtf is a connector? Actually that's not really my question it obviously connects MySQL and .NET but is it installed on the server with MySQL or the server with the .NET app? Because I'm only able to find a windows executable for it, surely there must be a linux version if it's supposed to be installed on the MySQL side.


Scratch all of that, got it working. Downloaded this https://cherrycitysoftware.com/CCS/Providers/ProvMySQL.aspx on .net application server.
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
September 26 2010 14:02 GMT
#399
Let's ask some more questions! Weeee! Not going to edit because no one will answer if it doesn't get bumped.

This time, how do I sockets? Relax, I'll go more in depth, here's my current set up:

VM Linux with MySQL <- Server application (C#) <- Client application(C#). All well and good, in fact I can register and "log in" based on data from the database. However I'm stuck when it comes to handling multiple user connections. Now, I obviously want threads, but how do I "manage" the connections?

I'm thinking I should keep an array of users that connect, then make a separate thread for each user of course, and then dispose of the threads that aren't in use because users disconnected.

Makes sense right? But how do I go about doing that? I.E. Do I make one "master socket" that everyone connects to, then make a new thread every time someone connects to it, and somehow automagically transfer that client over to the new socket?

All in all I am confuse.
goswser
Profile Blog Joined May 2009
United States3548 Posts
September 26 2010 14:20 GMT
#400
Wow, wish I noticed this thread last year when I was in AP Computer Science, I always wanted to learn more languages than java and vb (only languages I know), but never knew how to get started. This thread is awesome, thanks to everyone involved!
say you were born into a jungle indian tribe where food was scarce...would you run around from teepee to teepee stealing meat scraps after a day lazying around doing nothing except warming urself by a fire that you didn't even make yourself? -rekrul
Prev 1 18 19 20 21 22 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 15m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft821
StarCraft: Brood War
Calm 10868
Horang2 720
actioN 227
Pusan 160
Backho 146
Zeus 127
Leta 92
PianO 78
ToSsGirL 58
Shine 30
[ Show more ]
sSak 27
Dewaltoss 27
JulyZerg 23
soO 21
NaDa 10
Sacsri 9
IntoTheRainbow 8
Noble 4
League of Legends
JimRising 536
Counter-Strike
olofmeister1344
shoxiejesuss867
ceh9526
Super Smash Bros
Mew2King75
Organizations
Counter-Strike
PGL199
Other Games
BasetradeTV174
StarCraft: Brood War
UltimateBattle 82
lovetv 12
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• LUISG 6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3410
Upcoming Events
Wardi Open
3h 15m
Monday Night Weeklies
7h 15m
Replay Cast
15h 15m
Sparkling Tuna Cup
1d 1h
WardiTV Spring Champion…
1d 2h
Maestros of the Game
1d 6h
The PondCast
2 days
Kung Fu Cup
2 days
uThermal 2v2 Circuit
2 days
Maestros of the Game
2 days
[ Show More ]
Replay Cast
2 days
Replay Cast
3 days
WardiTV Spring Champion…
3 days
Maestros of the Game
3 days
Replay Cast
4 days
uThermal 2v2 Circuit
4 days
Maestros of the Game
4 days
Replay Cast
5 days
Solar vs Classic
uThermal 2v2 Circuit
5 days
GSL
5 days
herO vs Rogue
Maru vs Cure
uThermal 2v2 Circuit
6 days
BSL
6 days
Liquipedia Results

Completed

KK 2v2 League Season 1
RSL Revival: Season 5
Heroes Pulsing #1

Ongoing

BSL Season 22
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
CSCL: Masked Kings S4
YSL S3
SCTL 2026 Spring
WardiTV Spring 2026
Maestros of the Game 2
2026 GSL S2
Murky Cup 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026

Upcoming

BSL 22 Non-Korean Championship
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
uThermal 2v2 2026 Main Event
Heroes Pulsing #3
Heroes Pulsing #2
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 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.