bodchook

Members
  • Content count

    12
  • Joined

  • Last visited

Community Reputation

138 Neutral

About bodchook

  • Rank
    Member
  1. Check out this chapter on projectiles from the book Physics for Game Programmers.
  2. I really appreciate the replies! I went through the Induction I and II slides and in-class problems that daviangel linked to. The exact problem I originally posted was actually the first example in Induction I slides.. so that was very helpful! I can see that I need to brush up on my algebra a bit.. but that's no big deal. Thanks for the help =)
  3. Howdy. I'm working my way through Concrete Abstractions, and I'm trying to understand this proof by induction thing. Here is the exercise (note, this is not homework, this is just self-study): Consider the following procedure foo: (define foo (lambda (x n) (if (= n 0) 1 (+ (expt x n) (foo x (- n 1)))))) Use induction to prove that (foo x n) terminates with the value x^(n+1) - 1 ----------- x - 1 for all values of x =/ 1 and for all integers n >= 0. You may assume that expt works correctly, (i.e., (expt b m) returns bm). Hint: The inductive step will involve some algebra. The base case is n = 0, which is 1, which works. I think I understand the inductive hypothesis step, which is to assume that (foo x k) = ((x^k+1) - 1 / (x - 1)) for all values of k where x =/ 1 and 0 <= k < n. Not sure if that's right. As far as the inductive step.. I don't know how to do it. I kind of understand the example in the book where the author does an inductive proof of the square procedure, but in trying to apply that same process to this foo procedure isn't working for me. Any help would be appreciated! Edit: Another example, this one I think is easier, but I don't understand how it proves anything: Prove by induction that for every nonnegative integer n the following procedure computes 2n: (define f (lambda (n) (if (= n 0) 0 (+ 2 (f (- n 1)))))) So, the Base case (n = 0) checks out, and if I assume that f(k) = 2k where 0 <= k < n, then f(n-1) = 2 + 2(n-1) = 2 + 2n - 2 = 2n. So, didn't I just prove that this function works by assuming that it does? Huh? [Edited by - bodchook on December 23, 2008 12:32:41 PM]
  4. [web] MS Access application

    I'm not 100% sure about Access, but I have created a number of Excel applications at work. Excel has to be open for them to work, but you can hide this from the user with some simple automation. I would imagine Access would have similar functionality, considering it is part of the same suite as Excel. Downside is Excel (or Access, in your case) has to be installed. This is a non-issue for me because everyone has Excel installed by default. Anyway, try searching ms access applications to get yourself started.
  5. Introduction and Chapter 1

    I did some research last night and spent some time mulling over the problem above. I think I understand it now. I figured I would update this post with my thoughts in case anyone is interested. GameDev has a good article about recursion, which has the exact change counting algorithm from SICP. So basically, the article mentioned above walks through a simple case of making change for $.10 using dimes, nickels, and pennies. See below: Quote: To convince you that the reduction and boundary cases work, lets look again at the 10 cent problem (note that we're not interested in 25 and 50 cent coins in this case): So, to change 10 using the coins 10, 5 and 1 (ordered thus) we sum (1) the number of ways to change 10 using all but the first kind of coin, that is using 5 and 1 only, and (2) the number of ways to change amount 10 - 10 = 0 using all kinds of coins. (2) Is simple - there's one way to change amount 0 (by the first boundary case). (1) can be further reduced to (3) the number of ways to change amount 10 using 1 cent only, plus (4) the number of ways to change 10 - 5 = 5 using all kinds of coins. (3) Is only one way, ten 1 cent coins, (4) can be reduced, etc. (we get two ways from (4) - one five cent coin, and five one cent coins). When the algorithm finishes we'll end up with 4 ways. OK, this makes sense. If I owe you 10 cents, I can give you a dime, and be done. Or if I don't have any dimes, I can give you 10 pennies. If I don't have 10 pennies, I can give you 1 nickel and 5 pennies, or I can give your 2 nickels. And this follows exactly from the algorithm: Quote: The number of ways to change amount a using n kinds of coins equals * the number of ways to change amount a using all but the first kind of coin, plus * the number of ways to change amount a - d using all n kinds of coins, where d is the denomination of the first kind of coin. I see how this becomes a tree structure, because each call to count-change results in two more calls to count-change until the base-case is reached. The base cases in the algorithm are we have ran out of coins (n = 0), we have made change to 0 (a = 0), or we have given too much change (a < 0).
  6. Introduction and Chapter 1

    I started this book last week and I'm trying to work through all of the exercises. I'm having trouble visualizing the count-change procedure in Chapter 1.2.2. I tried stepping through the execution with small values for amount, but I'm getting lost! I was going to draw the tree structure out but it's complicated even for small values of amount. I mean, I understand the concept (I don't know if I would have thought to do it this way without seeing it in the book first, but the idea of breaking it into a - d recursively does make sense) but it's almost like I have to just *believe* the procedure works because it implements the algorithm which I _intuitively_ know will work, but is too confusing to follow to *make sure* it works!
  7. C++ programming exercises

    Quote:Original post by Splinter of Chaos That site looks really great. Do you have to solve a problem to see the solutions or am I just not seeing it? If you're referring to project euler, then yea, after you solve the problem you get access to the questions discussion form and also the author's solution. It's fun to see how other people approach problems. Sometimes you learn interesting ways of looking at things you wouldn't have thought of otherwise.
  8. python for games?

    Also check out Pyglet (Site seems to be down at the moment.. check out the Google Code page.
  9. [.net] Filling a Form using C#

    Quote:Original post by Harish Kumar Hi Guys, I am a prolific photographer and thanks to digital revolution I have some 2000 photos and my wife also a shutterbug has some 1000 and my brother possibly around 1500. Now we all want to create a family blog and upload it all there. Actually the forum is already created and have started uploading it but it is getting tedious. We would like to automate the process. Since we have photos of nice buildings and flora and fauna as well , I created subforums and I want to upload all the photos according to category. I have links from a variety of sites and I want to have all the photos in one place. Using httpWebRequest I have been able to successfully obtain web pages but I do not know how to use it to fill up the login form and when the next page comes up post the image links. I can do the logins manually if it is necessary but the posting needs to be automated. I could also use this in one of the projects in our company. We are uploading an entire database of information to a website. This involves manually typing all the information to asp forms and that way populate server database. It would be good if I can automate this as well. So can you tell me how I should go about doing it ? Internet Explorer automation is the way to go. I recommend using VBScript. Aww hell.. it's been slow at work today. I could probably throw something together for you before I go home =) Let me know.
  10. I was browsing the internet yesterday during lunch and found a site that has a few games that were created with Excel. I thought this was pretty cool so I threw together my own simple Excel game, Guess The Number. You get 5 guesses at choosing a number between 0 and 100 (and the range is editable, to increase or decrease the difficulty). Check it out here. Does anyone else have any interesting Excel creations?
  11. What about: vector<Whatever*> v; int index = (d == 0.5) ? v.size() * d - 1 : v.size() * d;
  12. Starting a program when the computer starts

    Quote:Original post by deadstar Package your application up into a .msi installer, it'll sort out things like desktop shortcuts, start menu entries and if I'm not mistaken it provides the ability to add it to the Startup menu. There's plenty of packaging tools, I'd recommend the Nullsoft installer. To add to deadstar's reply, you could also try using a lesser-known tool that's included with Windows called IExpress (Start->Run->IExpress). It allows you to make a self-extracting executable that will run an installation script that you specify as part of the unpacking process. I've used it at work to install a script on some co-workers' computers to block a stupid time-out window from popping up on one of the web apps we use. The installation script is just a batch file that copies the script file to the start-up folder in the start menu.