Search:

Type: Posts; User: tomcant

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: pow command

    by tomcant
    Replies
    9
    Views
    2,306

    What happens when you compile and and run this...

    What happens when you compile and and run this code?

    #include <iostream>
    #include <cmath>

    int main(){
    for(int x=1;x<21;x++){
    int y = pow(x,2);
    std::cout << y << std::endl;
    }
  2. Thread: TicTacToe AI

    by tomcant
    Replies
    9
    Views
    3,675

    And how are you going to compute that...

    And how are you going to compute that information? A minimax tree perhaps? :)
  3. Replies
    2
    Views
    2,544

    ... and the problem is? That's a lot of code to...

    ... and the problem is? That's a lot of code to look through. Perhaps you can point us towards a specific problem you're having.
  4. Thread: TicTacToe AI

    by tomcant
    Replies
    9
    Views
    3,675

    I posted in a thread here...

    I posted in a thread here not so long ago. I basically explain how to get a variation of the minimax algorithm up and running. This variation is called AlphaBeta and produces exactly the same output...
  5. Thread: char*&?

    by tomcant
    Replies
    2
    Views
    1,212

    When passing an address to a function, regardless...

    When passing an address to a function, regardless of the type of variable, the function will not work on a copy of that variable, but the actual variable itself. So when you pass a char*& to a...
  6. Thread: Binary Tree

    by tomcant
    Replies
    7
    Views
    1,158

    In your `inorder' function, you are referencing a...

    In your `inorder' function, you are referencing a variable `current' and there appears to be no variable with that name in scope. There is a variable with that name, however, in your `inserttree'...
  7. Replies
    28
    Views
    2,489

    We need to know the format of the file with the...

    We need to know the format of the file with the sudoku puzzle in it. Also, if you could post any code you may have already tried, that would help.
  8. Replies
    18
    Views
    9,283

    So the program is now working as expected? Could...

    So the program is now working as expected? Could you post the updated code, then? I'd like to have a look at what can be done to make it faster. It is almost completely pointless to prune the game...
  9. Replies
    18
    Views
    9,283

    @tallguy: Could you let me know if that worked?

    @tallguy: Could you let me know if that worked?
  10. Replies
    18
    Views
    9,283

    Ok, the next thing to do is to take each element...

    Ok, the next thing to do is to take each element of the program (i.e. the isAWin(), playMove(), boardIsFull() and positionValue() functions), and test each of them individually. Having had another...
  11. Replies
    18
    Views
    9,283

    When searching for a best move, alpha and beta...

    When searching for a best move, alpha and beta should take initial values of -(LARGE_NUMBER) and +(LARGE_NUMBER), respectively. I'v written a few alphabeta searches before and what I like to do is...
  12. Replies
    18
    Views
    9,283

    The first problem I can see is that you never...

    The first problem I can see is that you never call chooseMove() with a specified depth, other than when you call chooseMove() from within itself. When you ask the program for a best move, you need to...
  13. Replies
    3
    Views
    10,020

    That code looks pretty bloated if it's just a...

    That code looks pretty bloated if it's just a template. I use this when beginning to write a Windows application:

    #include <windows.h>

    LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM...
  14. Replies
    18
    Views
    9,283

    If that still doesn't work, please post your...

    If that still doesn't work, please post your alphabeta function and any related code (i.e. any extra functions you use to generate, do, or undo moves). It will most likely be a very small problem in...
  15. Replies
    5
    Views
    1,302

    The element `temp[6][2]' won't exist if temp was...

    The element `temp[6][2]' won't exist if temp was declared as `temp[10][2]'.

    Looks to me like you need to overload the `[]' operator. You can do that like this:

    class Object{
    int *arr;
    int...
  16. Smashing point, anon. I can't believe my...

    Smashing point, anon. I can't believe my stupidity. Thanks.
  17. error: short, signed or unsigned invalid for `d'

    I have the following code:

    #include <iostream>

    int main(){
    unsigned double d=25.0;
    }
    When compiling on Windows XP Professional with g++ 4.3.2, I get the error message described by the...
  18. Replies
    9
    Views
    4,939

    A simple way to retrieve the target square from a...

    A simple way to retrieve the target square from a given square, is to setup an array for each possible direction of a piece. So, to find the square up-right from the bottom-left square on the board,...
  19. Replies
    42
    Views
    4,834

    Your confusing me. In that example, the words are...

    Your confusing me. In that example, the words are not scrambled. Do you mean something like this:

    file.txt - (scrambled)
    cat
    animal
    bear

    new_file.txt - (unscrambled)
    animal
    bear
  20. Replies
    2
    Views
    2,971

    Read text from the file using fread().

    Read text from the file using fread().
  21. Replies
    42
    Views
    4,834

    Tell us more about the order of the words once...

    Tell us more about the order of the words once the sorting has finished. Do they need to be in alphabetical order, or some other order?
  22. Replies
    11
    Views
    1,405

    I think I see what he means. Try this: #define...

    I think I see what he means. Try this:

    #define REF(a) (T##a)

    int T1,T2;

    for(int i=0;i<2;++i)
    REF(i)=some_int;

    Is that what you ment?
  23. Replies
    3
    Views
    946

    #include ... Sleep(1000); // sleep...

    #include <windows.h>
    ...
    Sleep(1000); // sleep for 1 second


    This is far from portable, but its ok as a little exercise, I guess.
  24. Thread: C++ newbie

    by tomcant
    Replies
    13
    Views
    1,522

    I think you must be mis-understanding things. If...

    I think you must be mis-understanding things. If you have the Borland command line compiler and its working (ie. you can compile code), then you will already have everything you need on your machine....
  25. Replies
    20
    Views
    1,685

    More importantly, can you see a way around the...

    More importantly, can you see a way around the flaw? Hint: Wouldn't it be a better idea to actually ask the user if he/she would like another go?
Results 1 to 25 of 32
Page 1 of 2 1 2