• Content count

  • Joined

  • Last visited

Community Reputation

154 Neutral

About GameDweeb

  • Rank
  1. Help using link list.

    Why not create a date type point that will hold an x and a y value. The data type could also have your pointers for your list so it would like something like this: class point { public: int m_x; int m_y; point *m_next; point *m_prev; };
  2. Using NAnt to biuld

    I figured it out, not sure why it worked. I thought I tried this already, but whatever it works so I'm not going ask questions... <exec program="C:\Program Files\codeBlocks\bin\g++.exe"> <arg value="main.cpp" /> <arg value="function_one.cpp" /> <arg value="function_two.cpp" /> <arg value="function_three.cpp" /> <arg value="function_four.cpp" /> <arg value="-o imTheMan.exe" /> </exec> Just in case anyone else had the same kind of question, there's what I did to get it to work.
  3. My boss wants me to learn how to use NAnt to biuld a project... I'm using code blocks right now, since I don't have VS. I'm not sure what I'm doing wrong, I can get this project to compile using a batch file, and then I can get it to compile using NAnt to launch the batch file. But I can't get NAnt to biuld it without the batch file, I guess get NAnt to launch g++ nativley. The script I'm working with right now looks like this: <?xml version="1.0"?> <project name="NAntCompilerFun" default="CompileMeBaby" basedir="."> <description> A simple script to use NAnt to automate a biuld of a program </description> <target name="CompileMeBaby"> <exec program="C:\Program Files\codeBlocks\bin\g++.exe"> <arg> <path> <pathelement dir="C:\Documents and Settings\brandon scriver\My Documents\Coding Projects\NAnt Make\" /> <pathelement file="main.cpp" /> <pathelement file="function_one.cpp" /> <pathelement file="function_two.cpp" /> <pathelement file="function_three.cpp" /> <pathelement file="function_four.cpp" /> </path> </arg> <arg value="-o imTheMan.exe" /> </exec> </target> </project> I'm having trouble figuring out the NAnt documentation. Any ideas one what I should be doing with this would be much appreciated.
  4. Towers of Hanoi iterativly

    I do notice a pattern with the order that the pieces move in. it woule be easy enough to extend it indefinetly. 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 etc. etc. I'm not sure what I'd need to write, seems like there'd need to be some if statements involved to get things to work right, but that might only be if I wanted to add user interactivity. Here's another question though... Can anyone help me understand the logic behind this: int hanoi(int n, int src, int aux, int dst) { if (n == 0) { return 0; } hanoi(n-1, src, dst, aux); cout << n << " " << src << " -> " << dst << endl; hanoi(n-1, aux, src, dst); return 1; } I put some stops in and tried to follow the logic through the debugger, but I haven't had much luck in following the logic. I think if I can understand this more clearly I should be able to come up with a solution for the previous problem.
  5. Understanding stack logic

    I've got a progam that looks like this: int hanoi(int n, int src, int aux, int dst) { if (n == 0) { return 0; } hanoi(n-1, src, dst, aux); cout << n << " " << src << " -> " << dst << endl; hanoi(n-1, aux, src, dst); return 1; } I can't seem to get a handle on how the logic works, I've got a basic understanding of how recursion works. I just can't figure out how to follow the variables that are being passed around from call to call. Can anyone help?
  6. Towers of Hanoi iterativly

    Okay, so I've got this problem in my programming class. I've got to come up with a non-recursive solution to the Towers of Hanoi. I'm getting stumped, I see a vague pattern in how you move the disks, depending on whether it's an odd or an even total. But I'm just not understanding what I need to do exactly. Any help in explaining what I need to do or what direction I need to look in would be much appreciated!
  7. using cin.getline with a file stream

    Thanks for the demonstration! -Brandon
  8. Defining a string in an object

    Thanks everybody! Everything runs great now! Now I'm gonig to work on rewritting the whole thing so I can manage having health and some enemies running around! -Brandon
  9. Defining a string in an object

    Okay so i'm working on a text based game (seems to be a hot topic), I'm running into a problem. I have a class set up for room objects, and I've got a string to store a short description of the room. Then I try to define the object's properties and the compiler gives me some error about changing from one varibale size to another. Here's the code; class room{ public: /*Yeah I should have these as private, but I don't have any methods defined in this class yet*/ int roomNo; char roomDesc[256]; }; okay there's the class, everything compiles fine till I try to set the string as somthing. The way I'm doing this is: room world[SIZEX][SIZEY][SIZEZ]; world[1][1][1].roomDesc = "THE CENTER OF THE WORLD"; When that's where the error happens, what am I doing wrong? Thanks for any help -Brandon