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;
}
Type: Posts; User: tomcant
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;
}
And how are you going to compute that information? A minimax tree perhaps? :)
... 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.
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...
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...
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'...
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.
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...
@tallguy: Could you let me know if that worked?
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...
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...
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...
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...
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...
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...
Smashing point, anon. I can't believe my stupidity. Thanks.
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...
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,...
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
Read text from the file using fread().
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?
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?
#include <windows.h>
...
Sleep(1000); // sleep for 1 second
This is far from portable, but its ok as a little exercise, I guess.
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....
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?