# bodchook

Member

12

138 Neutral

• Rank
Member
1. ## How can i plot a path though screenspace using an ARC?

Check out this chapter on projectiles from the book Physics for Game Programmers.
2. ## Concrete Abstractions Ex 2.16 (Proof by Induction)

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. ## Concrete Abstractions Ex 2.16 (Proof by Induction)

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.

10. ## Bored at Work: Games in Excel

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. ## My maths skills are shot, would like some help with an algorithm

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.