• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:24
CET 23:24
KST 07:24
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation12Weekly 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
Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview [TLMC] Fall/Winter 2025 Ladder Map Rotation TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
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
FlaSh on: Biggest Problem With SnOw's Playstyle What happened to TvZ on Retro? SnOw's ASL S20 Finals Review BW General Discussion Brood War web app to calculate unit interactions
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Clair Obscur - Expedition 33 Beyond All Reason
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
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread Artificial Intelligence Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread 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: 2086 users

The Big Programming Thread - Page 307

Forum Index > General Forum
Post a Reply
Prev 1 305 306 307 308 309 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.
waxypants
Profile Blog Joined September 2009
United States479 Posts
Last Edited: 2013-05-27 06:10:26
May 27 2013 05:00 GMT
#6121
On May 24 2013 10:37 phar wrote:
oh jesus my x86 is rusty

mov eax, 56111 // sticks 56111 into the 4 bytes of eax (? is it 4 or 8? fuck if I know, we're going with 4 byte registers woo)
mul eax // multiplies ? by eax, puts result into edx:eax... so is that 56111^2? I think no second arg means by itself here, not sure.
mov edx,0 // puts 0 into edx, so this means we get the 16 least significant bits of 56111^2... 29345 ?
div x // dword 100 is 4 bytes, so we're taking dividend/divisor (edx:eax is dividend, which recall is 29345, x is divisor, which is 100), result goes into eax and remainder goes into edx (or switch around?) 29345 / 100 = 293 remainder 45


so that sticks 293 in eax and 45 in edx
mov edx, 0 // zeroes out edx again
div y // same deal, except dividnig by something bigger than 293, so we get eax = 0, edx = 293.
mov eax, edx // intel backwards notation, moves edx into eax, so we end up with 293.



OR MAYBE THAT'S COMPLETE BULLSHIT I DUNNO LOL


Ooo someone asks a question very few people know about, but that I do. Somebody probably gave an adequate answer by now, but I'll be damned if I don't myself.

eax is 4 bytes. The "e" indicates it is the "extended" version of the 2-byte ax register. You can also address the lower and upper bytes of ax with the names al and ah. On x64 architecture, rax is the 8byte "version" of eax (eax lives in the bottom 4bytes of rax).

BTW, for the rest of this, the notation "edx:eax" means to take the 32-bits from edx, the 32-bits from eax, and mash them together into one big 64-bit value (with eax being the bottom 32-bits).

mul doesn't take a second argument, it is always eax:edx <-- eax*src (assuming src refers to a dword register or memory operand size). The result of this multiply is eax:edx <-- 56111*56111 = 3148444321

mov edx, 0 is clearing the top 32 bits of previous multiply, leaving the bottom 32-bits (which are in eax) intact. It is essentially doing edx:eax <-- edx:eax % (2^32). However, the top 32-bits from this multiply are 0 anyway (56111^2 < 2^32), so for the purposes of this exercise, this does nothing.

A dword-sized div takes edx:eax, divides by the single src value, so it does 3148444321 / 100. It puts the quotient in eax and the remainder into edx. So in this case the result is eax <-- 31484443 and edx <-- 21. We immediately clear edx afterword with the mov, so we are discarding the remainder and preparing for the next div.

Another div, so it is just 31484443 / 10000. The result is eax <-- 3148 and edx <-- 4443.

The final mov puts remainder from the last div (edx) into eax. So the result is eax <-- 4443. Therefore, eax contains 4443 at the end.
waxypants
Profile Blog Joined September 2009
United States479 Posts
May 27 2013 05:04 GMT
#6122
On May 24 2013 16:57 Terranist wrote:
Show nested quote +
On May 24 2013 11:27 Abductedonut wrote:
On May 24 2013 09:14 Terranist wrote:
if anyone could help me with this small snippet of assembly i would be grateful.

+ Show Spoiler +
x dword 100
y dword 10000
mov eax, 56111
mul eax;
mov edx,0
div x
mov edx,0
div y
mov eax, edx

; What number does the resulting eax contain?




To the poster above: Close but not quite...


mov eax, 56111 ; Puts 56111 into EAX (which is 32-bits... 64-bit would be RAX)
mul eax ; Multiplies EAX by EAX - Result is 3,148,444,321 and stored in EAX
mov edx,0 ; shouldn't need to explain this
div x ; Divides EAX by x, puts the remainder in EDX ( EAX = 31,484,443 EDX = 21)
mov edx,0 ;
div y ; Divides 31,484,443 by 10000, stores remainder in EDX (EAX = 3148 EDX = 4443)
mov eax,edx ; Puts EDX into EAX (EAX = 4443)


<3 ASM


thanks for the comments i see it now. learning ASM but i was not sure if mul eax with a large integer like that would create a signed or unsigned number.


imul is signed multiply, mul is unsigned multiply.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
May 27 2013 15:19 GMT
#6123
Seeing this Assembly reminds me of 1st year at university, and I'm finishing 2nd now. Assembly is definitely a language I'll never ever want to encounter again. So low level it hurts.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-05-27 18:46:58
May 27 2013 18:46 GMT
#6124
I worked with assembly in 16 bit pics so much my brain can't handle 32 bit registers. It's like any time I get a value > 65535 I mentally split it across two registers.

Good thing I now work with Java for a living, rofl.
Who after all is today speaking about the destruction of the Armenians?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-05-27 21:10:01
May 27 2013 21:09 GMT
#6125
@phar, is earning a lot from Java? Or is C++ the way to go for a living? I still haven't gone any route, but I'm comfortable with Java because it is easier. I guess I can try C++ anyway.
Roe
Profile Blog Joined June 2010
Canada6002 Posts
May 27 2013 21:11 GMT
#6126
On May 28 2013 00:19 darkness wrote:
Seeing this Assembly reminds me of 1st year at university, and I'm finishing 2nd now. Assembly is definitely a language I'll never ever want to encounter again. So low level it hurts.


i had the opposite feeling, it was so low level it felt good!
phar
Profile Joined August 2011
United States1080 Posts
May 27 2013 21:16 GMT
#6127
On May 28 2013 06:09 darkness wrote:
@phar, is earning a lot from Java? Or is C++ the way to go for a living? I still haven't gone any route, but I'm comfortable with Java because it is easier. I guess I can try C++ anyway.

I think we've covered this before man. There are high and low paying jobs for both C++ and Java (and a plethora of other languages). Don't sweat which specific language you're learning right now - most of the skills are transferable. You can pick up new languages really easily after you know the general concepts.
Who after all is today speaking about the destruction of the Armenians?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
May 27 2013 21:21 GMT
#6128
On May 28 2013 06:16 phar wrote:
Show nested quote +
On May 28 2013 06:09 darkness wrote:
@phar, is earning a lot from Java? Or is C++ the way to go for a living? I still haven't gone any route, but I'm comfortable with Java because it is easier. I guess I can try C++ anyway.

I think we've covered this before man. There are high and low paying jobs for both C++ and Java (and a plethora of other languages). Don't sweat which specific language you're learning right now - most of the skills are transferable. You can pick up new languages really easily after you know the general concepts.


Alright, thanks.

On May 28 2013 06:11 Roe wrote:
Show nested quote +
On May 28 2013 00:19 darkness wrote:
Seeing this Assembly reminds me of 1st year at university, and I'm finishing 2nd now. Assembly is definitely a language I'll never ever want to encounter again. So low level it hurts.


i had the opposite feeling, it was so low level it felt good!


The only enjoyable lowest level stuff for me is malloc and free in C so far. ^^
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2013-05-28 19:43:20
May 28 2013 19:41 GMT
#6129
What you said is in the spoiler, for comparison.
+ Show Spoiler +

@implementation currentViewController {
// Hold a reference to the child view controller so it's not lost as soon as it's presented
nextViewController _nextViewController;
}

// Let's navigate to the next view controller
- (void)userDidSomething {

// Create an instance of my next view controller
_nextViewController = [[nextViewController alloc] init];

// Display my next view controller
[self.navigationController pushViewController:_nextViewController animated:YES];
}


I did what you said, XCode told me to replace currentViewController or nextViewController with UIViewController in some cases due to errors, and I ended up with this:

@implementation currentViewController {

// Hold a reference to the child view controller so it's not lost as soon as it's presented

UIViewController *_nextViewController;

}



// Let's navigate to the next view controller

- (void)userDidSomething {



// Create an instance of my next view controller

_nextViewController = [[UIViewController alloc] init];


then I get an error for the next line of code which states "Property 'navigationController' not found on object of type currentViewController *'

 // Display my next view controller

[self.navigationController pushViewController:_nextViewController animated:YES];

}

@end


Any ideas why this is happening or what I should do instead?
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2013-05-28 21:15:20
May 28 2013 20:20 GMT
#6130
If you haven't subclassed the nextViewController, then yes you'll have to declare it as an instance of UIViewController, rather than an instance of a custom subclass. That change you did looks good.

The only reason I can think of as to why it's telling you self.navigationController is not a valid property of currentViewController is that currentViewController is not a subclass of UIViewController. All UIViewControllers and subclasses of UIViewController should have that property. You must be putting this code in some other place rather than a subclass of UIViewController.

Edit: I created an iPad example in github so you can see how it works: https://github.com/ctangen/ViewControllerTransition
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
May 28 2013 20:27 GMT
#6131
On May 24 2013 10:37 phar wrote:
oh jesus my x86 is rusty

...


OR MAYBE THAT'S COMPLETE BULLSHIT I DUNNO LOL


LOL everytime i read that i laugh
There is no one like you in the universe.
CorsairHero
Profile Joined December 2008
Canada9491 Posts
May 28 2013 23:54 GMT
#6132
On May 28 2013 06:11 Roe wrote:
Show nested quote +
On May 28 2013 00:19 darkness wrote:
Seeing this Assembly reminds me of 1st year at university, and I'm finishing 2nd now. Assembly is definitely a language I'll never ever want to encounter again. So low level it hurts.


i had the opposite feeling, it was so low level it felt good!

Consider a career in analyzing computer viruses and malware
© Current year.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2013-05-29 11:14:42
May 29 2013 11:14 GMT
#6133
On May 29 2013 05:20 enigmaticcam wrote:
If you haven't subclassed the nextViewController, then yes you'll have to declare it as an instance of UIViewController, rather than an instance of a custom subclass. That change you did looks good.

The only reason I can think of as to why it's telling you self.navigationController is not a valid property of currentViewController is that currentViewController is not a subclass of UIViewController. All UIViewControllers and subclasses of UIViewController should have that property. You must be putting this code in some other place rather than a subclass of UIViewController.

Edit: I created an iPad example in github so you can see how it works: https://github.com/ctangen/ViewControllerTransition

Thanks! I'll try it out again today. Hopefully your example will help me

@Blisse I laugh every time too
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
Duval
Profile Blog Joined February 2011
Belgium144 Posts
Last Edited: 2013-05-29 14:06:11
May 29 2013 14:05 GMT
#6134
Does anyone have any tips on the designing of a game using a UML diagram? I have to design an implementation of Puerto Rico (quite complex but fun game), but while in class our professor keeps empathizing the importance of a good design, I feel like we really haven't been told how to begin.

I've made easier diagrams before (simple card games, chess) but this game has so much going on I don't really know where to start.
artynko
Profile Joined November 2010
Slovakia86 Posts
May 29 2013 15:11 GMT
#6135
Just start with splitting the game into components (very big one in the beginning) and don't go into specifics. As soon as you can't split anymore go back reiterate the whole design and then start specifying the details in the components (i.e. a diagram that specifies how a card should be played).
If at any point while doing the physical model you find that the "implementation" doesn't fit the initial component idea, update the initial idea go to the initial component model and reiterate over it again. Repeat until you have a detailed model of the whole application.
phar
Profile Joined August 2011
United States1080 Posts
May 29 2013 17:14 GMT
#6136
Also don't worry about the specifics of UML too much. You may have to get that shit right for class, but out in the real world there's a good chance your designs are not going to be religiously following something like UML.
Who after all is today speaking about the destruction of the Armenians?
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2013-05-29 19:19:16
May 29 2013 19:18 GMT
#6137
On May 29 2013 20:14 3FFA wrote:
Show nested quote +
On May 29 2013 05:20 enigmaticcam wrote:
If you haven't subclassed the nextViewController, then yes you'll have to declare it as an instance of UIViewController, rather than an instance of a custom subclass. That change you did looks good.

The only reason I can think of as to why it's telling you self.navigationController is not a valid property of currentViewController is that currentViewController is not a subclass of UIViewController. All UIViewControllers and subclasses of UIViewController should have that property. You must be putting this code in some other place rather than a subclass of UIViewController.

Edit: I created an iPad example in github so you can see how it works: https://github.com/ctangen/ViewControllerTransition

Thanks! I'll try it out again today. Hopefully your example will help me

@Blisse I laugh every time too


Tried it out, was able to figure out how to get it to work! Thanks!

Still lost on how to set up a button to go to the next slide though ._. [makes me feel stupid cause it seems like it should be obvious]
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
May 29 2013 19:30 GMT
#6138
On May 30 2013 04:18 3FFA wrote:
Show nested quote +
On May 29 2013 20:14 3FFA wrote:
On May 29 2013 05:20 enigmaticcam wrote:
If you haven't subclassed the nextViewController, then yes you'll have to declare it as an instance of UIViewController, rather than an instance of a custom subclass. That change you did looks good.

The only reason I can think of as to why it's telling you self.navigationController is not a valid property of currentViewController is that currentViewController is not a subclass of UIViewController. All UIViewControllers and subclasses of UIViewController should have that property. You must be putting this code in some other place rather than a subclass of UIViewController.

Edit: I created an iPad example in github so you can see how it works: https://github.com/ctangen/ViewControllerTransition

Thanks! I'll try it out again today. Hopefully your example will help me

@Blisse I laugh every time too


Tried it out, was able to figure out how to get it to work! Thanks!

Still lost on how to set up a button to go to the next slide though ._. [makes me feel stupid cause it seems like it should be obvious]

Glad I can help If you ever need any help with anything iOS related, I'd be happy to help again.

If you get a chance to check out that example iPad application I posted, it should help you figure that last bit out. On the view load, I add a button to the navigation bar that calls another function that does the actual push.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
May 29 2013 21:10 GMT
#6139
I did. Just ran it.... says it can't load the simulator because of the version for some reason. =/
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
klo8
Profile Joined August 2010
Austria1960 Posts
May 29 2013 21:33 GMT
#6140
Hi!
I just recently started programming in C++ and my first real project is porting a thing I did in C# that draws L-Systems (basically fractals used for procedural generation of plants for example). I'm using SFML for drawing the things I need. It works fine, but my concern is that it uses up a lot more memory than I feel it should. The C# version of the program uses about 10 MB of RAM when I first start it up, and the C++ version uses 33 MB. (the C# version uses Windows Forms and the C++ version is just a raw window) I know this isn't a very smart comparison, but I still feel it's off. When I start increasing the number of iterations for some of the L-Systems, it very quickly rises to about 200 MB or more. It's not really a performance concern for me right now but I'd be interested in why there is so much memory being used.

What I'm looking for is methods on how to find where all that memory is going. I'm using VS2012 and the built-in profiler only has support for .NET-managed memory.

I've put the code on GitHub if someone feels like taking a look.
This post is clearly not a hurr, as you can see from the graph, the durr never intersects with the derp.
Prev 1 305 306 307 308 309 1032 Next
Please log in or register to reply.
Live Events Refresh
The PiG Daily
20:30
Best Games of SC
Serral vs Clem
Solar vs Cure
Serral vs Clem
Reynor vs GuMiho
herO vs Cure
PiGStarcraft327
LiquipediaDiscussion
BSL 21
20:00
ProLeague - RO32 Group C
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
ZZZero.O318
LiquipediaDiscussion
OSC
19:00
Masters Cup #150: Group B
davetesta56
Liquipedia
PSISTORM Gaming Misc
15:55
FSL teamleague CNvsASH, ASHvRR
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft327
Nathanias 101
ProTech70
StarCraft: Brood War
Shuttle 921
ZZZero.O 318
NaDa 57
Dota 2
LuMiX1
Counter-Strike
fl0m1151
Super Smash Bros
AZ_Axe95
Other Games
tarik_tv6434
Grubby5599
gofns3805
summit1g3783
DeMusliM415
Pyrionflax197
Fuzer 196
Dewaltoss11
ViBE5
Organizations
Other Games
EGCTV935
gamesdonequick774
StarCraft 2
angryscii 37
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• StrangeGG 58
• musti20045 14
• Dystopia_ 3
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2706
• Ler79
Other Games
• imaqtpie1667
• WagamamaTV502
• Shiphtur261
• tFFMrPink 14
Upcoming Events
Sparkling Tuna Cup
11h 36m
RSL Revival
11h 36m
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
13h 36m
Cure vs herO
Reynor vs TBD
WardiTV Korean Royale
13h 36m
BSL 21
21h 36m
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
21h 36m
Dewalt vs WolFix
eOnzErG vs Bonyth
Replay Cast
1d
Wardi Open
1d 13h
Monday Night Weeklies
1d 18h
WardiTV Korean Royale
2 days
[ Show More ]
BSL: GosuLeague
2 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
BSL: GosuLeague
4 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
WardiTV Korean Royale
6 days
IPSL
6 days
Julia vs Artosis
JDConan vs DragOn
Liquipedia Results

Completed

Proleague 2025-11-14
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
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
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

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
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.