Wrox Programmer Forums
|
BOOK: Beginning iOS Game Development
This is the forum to discuss the Wrox book Beginning iOS Game Development by Patrick Alessi ; ISBN: 978-1-1181-0732-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS Game Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2011, 10:07 AM
Registered User
 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ok so Far.

I just bought this book a few days ago. As a C++ programmer, everything was straight forward, but as the little of the book said "Beginning". With that I fell that some of the context was misplaced.

I believe that Chapter 3 should have been chapter 2 and vice versa. Reason is because on chapter 2, there was a lot of "do this now and I'll explain it later" kinda thing, and that's kinda confusing. Like for me NSLog(@"%i",i). At the time I knew it kinda functioned like an printf of some sort, but "beginners" don't know what it means. Also the for loops and switch statements was a "type this and it will print some numbers, but I'll explain it later".

There was also a lot of "Now press enter and type i then press right 3 times.....", instead of that, you should have given the code.

I'm still on chapter 4. Will post my thoughts of the content bellow when I'm done.

PS. So far this book is ok. I can't really say much since I'm still at the beginning.

Last edited by simon66; December 30th, 2011 at 10:14 AM..
 
Old January 4th, 2012, 06:43 AM
Registered User
 
Join Date: Dec 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey did you succeed to run the magicMind game program?

i am kinda stuck on that. it gives me some kind of "NSCSFString autoreleased with no pool"
 
Old January 4th, 2012, 08:58 AM
Registered User
 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't do that part as I skipped that chapter. I can take a look at it after when I get home.
 
Old March 11th, 2012, 04:19 PM
Authorized User
 
Join Date: Mar 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by simon66 View Post
I just bought this book a few days ago. As a C++ programmer, everything was straight forward, but as the little of the book said "Beginning". With that I fell that some of the context was misplaced.

I believe that Chapter 3 should have been chapter 2 and vice versa. Reason is because on chapter 2, there was a lot of "do this now and I'll explain it later" kinda thing, and that's kinda confusing. Like for me NSLog(@"%i",i). At the time I knew it kinda functioned like an printf of some sort, but "beginners" don't know what it means. Also the for loops and switch statements was a "type this and it will print some numbers, but I'll explain it later".

There was also a lot of "Now press enter and type i then press right 3 times.....", instead of that, you should have given the code.

I'm still on chapter 4. Will post my thoughts of the content bellow when I'm done.

PS. So far this book is ok. I can't really say much since I'm still at the beginning.
I think the flow is fine. Chapter 2 is mostly to get the reader motivated than anything, like "wow I created something! Not sure how I did it, but I can't wait to find out"
 
Old May 3rd, 2012, 03:18 PM
Registered User
 
Join Date: May 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Flow is fine, but some aspects could use some explanations or probably simpler workarounds. Now I am struggling to understand why modulus operator is used to get random card from deck...why take result of random function and apply modulus to it?
 
Old May 3rd, 2012, 09:32 PM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

The value of the random number cannot be larger than the number of cards. The modulus operator takes the number generated by random() and divides by 52 producing the remainder as a result. This number will range from 0-51, the 52 indices of the deck array. The value of random(), before applying modulus will, under most circumstances, far exceed the size of the array.

add the following bold code to the "do" loop in the Cards project and you can inspect the value of the generated random number.

Code:
    do {
        // Generate 2 random numbers to determine which cards to swap
        randomA = random() % 52;
        randomB = random() % 52;
        printf("Random is %ld",random());
This should clarify why modulus is needed; to limit the range of numbers.

Bob
 
Old May 4th, 2012, 01:26 AM
Registered User
 
Join Date: May 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So if I want to get random value from range I always use modulus?

at least now I understand why there was modulus. Somehow didn't get it while reading first
Thanks.

p.s.
being a noob I was first expecting to see something like:
Code:
randomA = random(52);
randomB = random(52);
which is wrong of course









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.