• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:29
CEST 08:29
KST 15: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
Team Liquid Map Contest #22 - The Finalists14[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers11Maestros of the Game 2 announced32026 GSL Tour plans announced11Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid21
StarCraft 2
General
MaNa leaves Team Liquid 2026 GSL Tour plans announced Team Liquid Map Contest #22 - The Finalists Weekly Cups (April 6-12): herO doubles, "Villains" prevail Oliveira Would Have Returned If EWC Continued
Tourneys
GSL CK: More events planned pending crowdfunding 2026 GSL Season 1 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 521 Memorable Boss The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Data needed ASL21 General Discussion Pros React To: Tulbo in Ro.16 Group A RepMastered™: replay sharing and analyzer site
Tourneys
Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro16 Group A [ASL21] Ro16 Group B
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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 Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1922 users

The Big Programming Thread - Page 380

Forum Index > General Forum
Post a Reply
Prev 1 378 379 380 381 382 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
Poland17727 Posts
October 23 2013 08:01 GMT
#7581
On October 23 2013 05:22 Tobberoth wrote:
Shouldn't isdigit be enough?

bool found_nondigit = false;
for (int i = 0; i < strLength; i++)
{
if (isdigit(xString.at(i)) != 0)
{
found_nondigit = true;
}
}

return !found_nondigit;


http://stackoverflow.com/questions/13440831/how-do-i-check-if-input-is-an-integer-string
Time is precious. Waste it wisely.
Rollin
Profile Joined March 2011
Australia1552 Posts
October 23 2013 11:57 GMT
#7582
On October 23 2013 16:38 Tobberoth wrote:
Show nested quote +
On October 23 2013 16:32 v0rtex wrote:
I'm interested in learning game programming. My main language is Java and I have dabbled in C++ for a while. I wouldn't say im a novice coder but I have mainly focused on Java due to studies. Should I learn Android game programming (I have already done 2D games with Swing etc...) or should I focus on C++ and learn SDL? My goal is to eventually become a game developer but I am unsure of what to focus on now? I think android is good as I can get apps out there and expand my portfolio plus it seems easier as Java is my main language? Or should I not take this detour and just focus on C++ and SDL then go into OpenGL?

Any advice is appreciated. Thanks!

I guess it depends on what you want to do. If you want to work at a company doing cellphone games, android is obviously the way to go. If you want to work on PC/Console AAA titles, C++ will probably be more important to know. Java is just not really useful for games, it's so rare to use it. I would assume most "real" commercial android games are programmed in other languages than java, such as C++.

If I were you, I would go with C++ and SFML. SDL works I guess, but SFML is just much cleaner and powerful, and modern for that matter.

An android/iOS port for SFML is also in the making as of right now. If you're more comfortable with Java there is a port for that too, although mobile support will take longer.
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2013-10-23 12:44:09
October 23 2013 12:40 GMT
#7583
hi guys, i currently have some university level CS courses. They are either general stuff or Java related.
So, i wanted to learn C# "on the side" because a lot of companies in my area use it.


Does anyone have a good source for exercises and little projects?
I learned C++ this way in my youth and i still remember most of it, so i think its a very good way for me to learn, but i dont have the time atm to come up with my own projects like i did when i was still in school.

I have Murach Csharp book, but the exercises are very simple.
Mstring
Profile Joined September 2011
Australia510 Posts
October 23 2013 13:07 GMT
#7584
On October 23 2013 21:40 LaNague wrote:
Does anyone have a good source for exercises and little projects?

Use it or lose it... your own imagination that is
gedatsu
Profile Joined December 2011
1286 Posts
October 23 2013 17:34 GMT
#7585
On October 23 2013 21:40 LaNague wrote:
Does anyone have a good source for exercises and little projects?

http://projecteuler.net/
sob3k
Profile Blog Joined August 2009
United States7572 Posts
October 25 2013 05:01 GMT
#7586
Can someone on here who knows their way around CSS/HTML and keyframe animations PM me? I have some questions/issues and want to bounce a few ideas off of someone who knows what they're doing. Would be suuper helpful!
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
October 25 2013 10:40 GMT
#7587
For a class assignment I have to produce a simple "pokemon" game in C# to get used to object orientated style ("object orientation"?)

The game is turn-based:

player1 chooses 6 monsters
player2 chooses 6 monsters
each monster has 4 skills

game starts:
player1 selects 1 of his monsters
player 2 selects 1 of his monsters

player1 clicks a skill on his monster; damage is dealt to opponent's monster
player 2 clicks a skills on his monster; damage is dealt to opponent's monster

repeat until a player's monster's health is 0.
when this occurs, that player must choose one of his remaining monsters to continue to battle with



i am just trying to figure out the logical process of it...

we are supposed to start with classes then try to write use case texts

so i have classes:
ability
monster
player
GUI

for use case text i am looking at something like this:

Attack With a Monster:

1. user clicks on a monster's attack button
2. system calls monster's attack function
3. attack function checks to see what is opponent's monster
4. attack function completes with effect (damage/heal)
(end turn)
5. system calls endTurn function
6. system checks health of opponent's monster
7. if opponent monster has health, call nextTurn function passing in needNewMonster as 0
8. nextTurn changes activePlayer to player2 and nonActivePlayer to player1
9. system triggers startTurn function which sees needNewMonster 0 and opens activePlayer's currentMonster attack GUI

alternative from 7:
7. if monster has no health, call nextTurn function passing in needNewMonster as 1
8. nextTurn changes activePlayer to player2 and nonActivePlayer to player1
9. system triggers startTurn function which sees needNewMonster 1 and opens activePlayer's chooseNewMonster GUI


if anyone with a fast mind would like to have a quick read through of this and see if i'm overcomplicating it ...

i want to check the health of opponent's monster at the end of the turn - if it's 0 then that player needs to select a new monster before we allow player2 to make his attack

THANKS ps i dont really want solutions unless its an example of how to condense this better
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
October 25 2013 11:09 GMT
#7588
ps , my tutor wrote his in a different way (for prototype purpose)

what i thought was to check a player's array of monsters - if they are all null then that player has lost.

however , my tutor instead set an attribute of each monster object to isDefeated , and instead checked these.

a side-effect of this is that he retains a list of which monsters belong to each player even after they're dead, so can do things like grey them out on the monster select screen.

can you see how my thinking differed from his, here?

its interesting
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
bangsholt
Profile Joined June 2011
Denmark138 Posts
October 25 2013 11:35 GMT
#7589
A few notes:

Your number 7 in your use case could as well call a function only when you need a new monster. You have an if statement after all.

Number 9 is then looking at some variable you probably set in the player object to figure if you should open the attack GUI or select monster GUI

Why do you want to set the references to the monster to null? You're effectively losing the information and if you forget a null check your program dies (which, depending on how well you have structure your program also can take considerable time to figure out where happens)

I would go with your teachers suggestion because you don't lose information then
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2013-10-25 11:54:53
October 25 2013 11:50 GMT
#7590
i think this is what you mean:

6. system checks health of opponent's monster
7. if opponent monster has no health, set opponent's needsNewMonster attribute to 1
8. system calls nextTurn, changing activePlayer to player2 and nonActivePlayer to player1
9. system calls startTurn function which checks needsNewMonster
10. if needsNewMonster if 1, system opens activePlayer's selectMonster GUI
11. (go to select monster use case)


edit: my tutor said i should also have a Main or Game class instead of putting lots of stuff in the GUI class
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
supereddie
Profile Joined March 2011
Netherlands151 Posts
Last Edited: 2013-10-25 12:40:54
October 25 2013 12:40 GMT
#7591
Your use cases are too big. Make them smaller/split them up.
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-10-25 13:40:24
October 25 2013 13:35 GMT
#7592
So if I want to read different board puzzles from files which I then store as objects each, what List should I choose if I don't need thread-safety? I think LinkedList would suit me because of fast insertion. However, if I need to get the object of puzzle No "x", then it would be O(n) which is still fine by me. Thoughts?
patermatrix
Profile Joined March 2012
64 Posts
October 25 2013 13:42 GMT
#7593
On October 25 2013 22:35 darkness wrote:
So if I want to read different board puzzles from files which I then store as objects each, what List should I choose if I don't need thread-safety? I think LinkedList would suit me because of fast insertion. However, if I need puzzle No "x", then it would be O(n) which is still fine by me. Thoughts?

Unless we're talking about tens of thousands of entries it really doesn't matter.

Additionally, if your code uses interfaces instead of concrete classes (I assume you're programming in Java or C#), it should be quite easy to change the underlying implementation of List.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
October 25 2013 14:02 GMT
#7594
On October 25 2013 22:35 darkness wrote:
So if I want to read different board puzzles from files which I then store as objects each, what List should I choose if I don't need thread-safety? I think LinkedList would suit me because of fast insertion. However, if I need to get the object of puzzle No "x", then it would be O(n) which is still fine by me. Thoughts?

Think about that fast insertion thing again: You're reading files. From disk. The slowest thing in the whole computer by a factor of like 100,000. Does insertion time matter?
If you have a good reason to disagree with the above, please tell me. Thank you.
devilesk
Profile Joined May 2005
United States140 Posts
October 25 2013 14:20 GMT
#7595
Did I go full retard this morning, or am I just arguing with one? I think a little bit of both. I need an unbiased third party opinion on this.

http://www.reddit.com/r/DotA2/comments/1p6sds/is_it_possible_for_a_game_to_result_in_a_draw/cczb32w?context=3
www.devilesk.com/dota2
tofucake
Profile Blog Joined October 2009
Hyrule19203 Posts
October 25 2013 14:34 GMT
#7596
That's...essentially true.
Liquipediaasante sana squash banana
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-10-25 14:39:19
October 25 2013 14:36 GMT
#7597
On October 25 2013 23:20 devilesk wrote:
Did I go full retard this morning, or am I just arguing with one? I think a little bit of both. I need an unbiased third party opinion on this.

http://www.reddit.com/r/DotA2/comments/1p6sds/is_it_possible_for_a_game_to_result_in_a_draw/cczb32w?context=3

It very much depends on the implementation. LoL games can be a draw as far as I know.

Typically, such a game works in frames; all things that happen in one frame are calculated and in a seperate, later action triggers like winning are checked based on the new frame state. And if the game is programmed such that it checks if both teams fulfill the win/lose condition during the same frame, it is a draw, then it is a draw. If it doesn't care about the second team and just declares a winner as soon as it finds someone met the winning condition, then it's not a draw.

It is however not out of the realm of possibility that the game enters winner-determined-mode as soon as some condition is met during frame update.

I'd say it is very likely that draws are possible in DotA2.

Also: clearly both.

(and that other guy certainly has no idea about game programming)
If you have a good reason to disagree with the above, please tell me. Thank you.
devilesk
Profile Joined May 2005
United States140 Posts
October 25 2013 14:48 GMT
#7598
On October 25 2013 23:36 spinesheath wrote:
Show nested quote +
On October 25 2013 23:20 devilesk wrote:
Did I go full retard this morning, or am I just arguing with one? I think a little bit of both. I need an unbiased third party opinion on this.

http://www.reddit.com/r/DotA2/comments/1p6sds/is_it_possible_for_a_game_to_result_in_a_draw/cczb32w?context=3

It very much depends on the implementation. LoL games can be a draw as far as I know.

Typically, such a game works in frames; all things that happen in one frame are calculated and in a seperate, later action triggers like winning are checked based on the new frame state. And if the game is programmed such that it checks if both teams fulfill the win/lose condition during the same frame, it is a draw, then it is a draw. If it doesn't care about the second team and just declares a winner as soon as it finds someone met the winning condition, then it's not a draw.

It is however not out of the realm of possibility that the game enters winner-determined-mode as soon as some condition is met during frame update.

I'd say it is very likely that draws are possible in DotA2.

Also: clearly both.

(and that other guy certainly has no idea about game programming)


I just think whether ties can or can't be implemented has nothing to do with the actual CPU only being able to execute one instruction at a time, which is what the other guy seems to be arguing.
www.devilesk.com/dota2
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-10-25 14:57:29
October 25 2013 14:56 GMT
#7599
On October 25 2013 23:48 devilesk wrote:
Show nested quote +
On October 25 2013 23:36 spinesheath wrote:
On October 25 2013 23:20 devilesk wrote:
Did I go full retard this morning, or am I just arguing with one? I think a little bit of both. I need an unbiased third party opinion on this.

http://www.reddit.com/r/DotA2/comments/1p6sds/is_it_possible_for_a_game_to_result_in_a_draw/cczb32w?context=3

It very much depends on the implementation. LoL games can be a draw as far as I know.

Typically, such a game works in frames; all things that happen in one frame are calculated and in a seperate, later action triggers like winning are checked based on the new frame state. And if the game is programmed such that it checks if both teams fulfill the win/lose condition during the same frame, it is a draw, then it is a draw. If it doesn't care about the second team and just declares a winner as soon as it finds someone met the winning condition, then it's not a draw.

It is however not out of the realm of possibility that the game enters winner-determined-mode as soon as some condition is met during frame update.

I'd say it is very likely that draws are possible in DotA2.

Also: clearly both.

(and that other guy certainly has no idea about game programming)


I just think whether ties can or can't be implemented has nothing to do with the actual CPU only being able to execute one instruction at a time, which is what the other guy seems to be arguing.

This is absolutely, certainly and without a shadow of a doubt true (source: CS student with actual programming practice).
if(x && y) draw();
else if(x) win(team1);
else if(y) win(team2);
If you have a good reason to disagree with the above, please tell me. Thank you.
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
October 25 2013 14:57 GMT
#7600
On October 25 2013 23:20 devilesk wrote:
Did I go full retard this morning, or am I just arguing with one? I think a little bit of both. I need an unbiased third party opinion on this.

http://www.reddit.com/r/DotA2/comments/1p6sds/is_it_possible_for_a_game_to_result_in_a_draw/cczb32w?context=3


You're sort of right but I'd have argued it slightly differently. Since really processing is so fast there is always going to be one action occurring before the other, one event being processed before and while you could do some sort of win state check it doesn't seem like something that would scale well to large games, at least based on my very limited understanding.

Since DotA2 is a multiplayer game though latency could come into play and two clients may both claim to have the winning blow, in which case you could consider that a tie provided they are within a close enough time window, but that's assuming I know how the game is implemented, which I don't and its probably far more elaborate and doesn't allow for that kind of situation.

The guys reasoning is technically OK I suppose, he's just not engaged his brain and thought about the question, the question is whether its possible within the game, unless its been seen to happen that can only be known by a developer. He made a reasonable assumption as to why they wouldn't be forced to include a draw condition (ie the winner could always accurately be determined) but of course they could just throw one in any way, there are no rules saying they can't so really its a bit of a daft argument and I don't know why you continued it as long as you did.
Prev 1 378 379 380 381 382 1032 Next
Please log in or register to reply.
Live Events Refresh
The PiG Daily
22:15
Best Games of SC
Rogue vs MaxPax
Maru vs Zoun
SHIN vs Cure
ByuN vs TBD
PiGStarcraft262
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
scan(afreeca) 879
Pusan 202
Sacsri 109
Backho 71
Noble 21
Bale 18
Aegong 17
Dota 2
NeuroSwarm168
ODPixel161
League of Legends
JimRising 701
Counter-Strike
Stewie2K1196
m0e_tv226
Super Smash Bros
hungrybox479
Mew2King65
Other Games
summit1g10763
WinterStarcraft468
C9.Mang0354
PiGStarcraft259
RuFF_SC258
Trikslyr35
Organizations
Other Games
gamesdonequick844
Dota 2
PGL Dota 2 - Main Stream387
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• practicex 59
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1250
• Stunt457
Upcoming Events
CranKy Ducklings
3h 31m
WardiTV Map Contest Tou…
4h 31m
SC Evo League
7h 1m
IPSL
9h 31m
WolFix vs nOmaD
dxtr13 vs Razz
BSL
12h 31m
UltrA vs KwarK
Gosudark vs cavapoo
dxtr13 vs HBO
Doodle vs Razz
Patches Events
15h 31m
CranKy Ducklings
17h 31m
Sparkling Tuna Cup
1d 3h
WardiTV Map Contest Tou…
1d 4h
Ladder Legends
1d 8h
[ Show More ]
BSL
1d 12h
StRyKeR vs rasowy
Artosis vs Aether
JDConan vs OyAji
Hawk vs izu
IPSL
1d 12h
JDConan vs TBD
Aegong vs rasowy
Replay Cast
2 days
Wardi Open
2 days
Afreeca Starleague
2 days
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
2 days
RSL Revival
2 days
Afreeca Starleague
3 days
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
3 days
RSL Revival
4 days
Replay Cast
4 days
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Map Contest Tou…
5 days
Replay Cast
5 days
Escore
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Escore Tournament S2: W3
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 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.