i have to make this board game in visual c++. i got the source code in c from a website. but it has some problem and isnt' running. moreover,its a hectic task to convert it into c++ for my use. if anyone who has worked on scrabble cud help me with it??also,we have'nt been taught graphics in vc++! i'd need to learn them in order to make this game!??help me with this too!

this is what the board looks like(as in the code i found from the website):-

//board.cpp
#include "board.h"
 
CBoard::CBoard()
{
xmax = ymax = 15;
firstword = FALSE;
//create the initial tile set and put them in the tilebag list
char tile_letters[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int numtiles[26] = {9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1};
 
int i; //outer loop counter
int j; //inner loop counter
for(i=0;i<26;i++) { //for each letter
for(j=0;j<numtiles[i];j++) { //make tile j times
tilebag.AddHead(new CTile(tile_letters[i]));
}
}
//special case for blanks
//makes 2 blank tiles
tilebag.AddHead(new CTile());
tilebag.AddHead(new CTile());
 
//set the squares array to NULL
for (i=0;i<15;i++) {
for (j=0;j<15;j++) {
squares[i][j] = NULL;
}
}
 
}
//returns NULL if there are no tiles left in bag
CObject* CBoard::GetRandomTile() {
CObject *tmp;
POSITION pos;
srand(time(NULL));//used to when getting a random number between 0 and number elements in tilebag
int limit = tilebag.GetCount();
//limit++; //evil bug of random crashies = squashed!
int random;
//special cases where random breaks
if (limit == 0) //fix
return NULL;
 
if (limit == 1) {
pos = tilebag.FindIndex(0);
tmp = tilebag.GetAt(pos);
tilebag.RemoveAt(pos);
return tmp;
}
//////////////////////////////////
 
random = rand()%limit;
//the general random workies case
if( ( pos = tilebag.FindIndex( random )) != NULL ) {
 
tmp = tilebag.GetAt(pos);
tilebag.RemoveAt(pos);
} 
else {
tmp = NULL;
}
 
return tmp;
}
//returns a copy of the tile at specified position (used in drawing)
CObject* CBoard::GetBoardTile(int x, int y) {
return squares[x][y];
}
///////////////////////////
// polymorphism at work :) 
//////////////////////////
//return a tile to the tilebag (swapping)
void CBoard::AddTile(CObject *tile) {
tilebag.AddTail(tile);
}
//add tile to a square[x][y]
void CBoard::AddTile(CObject *tile, int x, int y) {
 
squares[x][y] = tile;
}
///////////////////////////
// checks a squares index position to see if tile is there
bool CBoard::IsEmpty(int x, int y) {
 
//make sure player score functions dont request tiles out of board
if (x < 0 || x >= xmax || y < 0 || y >= ymax)
return TRUE;
 
if (squares[x][y] == NULL) {
return TRUE;
}
else {
return FALSE;
}
}
//returns value of tile at position
int CBoard::GetScore(int x, int y) {
CObject *object;
CTile *tile;
//make sure player score functions dont request tiles out of board
if (x < 0 || x >= xmax || y < 0 || y >= ymax)
return 0;
if (squares[x][y] == NULL) {
return 0;
}
else {
//read out tile->value
object = squares[x][y];
tile = (CTile *)object;
return tile->GetValue();
}
 
}
CBoard::~CBoard()
{
//traverse squares and tilebag to delete tiles
CObject *object;
CTile *tile;
POSITION pos;
int i,j;
//remove tiles in the tilebag
for( pos = tilebag.GetHeadPosition(); pos != NULL; ) { 
 
object = tilebag.GetNext(pos);
tile = (CTile*) object;
 
delete tile;
}
//remove tiles in squares[][]
for (i=0;i<15;i++) {
for (j=0;j<15;j++) {
object = squares[i][j] = NULL;
tile = (CTile*) object;
delete tile; 
}
}
 
}
#ifndef BOARD_HEADER
#define BOARD_HEADER
#include "tile.h"
#include <afxcoll.h>
 
class CBoard {
public: 
 
bool firstword; // flag to give first player double score 
 
CBoard();
CObject* GetRandomTile(); //from tilebag
CObject* GetBoardTile(int x, int y); //returns copy of a tile at position (for drawing)
void AddTile(CObject *tile); // add tile to tilebag (swaps)
void AddTile(CObject *tile, int x, int y); // add tile to squares
 
bool IsEmpty(int x, int y); // check if squares[x][y] exists
int GetScore(int x, int y); //checks squares position for tile and returns score or 0 if no tile
 
~CBoard ();
private:
 
int xmax;
int ymax; 
 
/* 
Why 2D array instead of CObList, you might ask. Here are some reasons
 
tiles dont have to store x,y
you dont have to traverse entire list to check if a given x,y is empty
it is a more logical representation of real life board data
*/ 
CObject *squares[15][15];
CObList tilebag; 
 
};
 
#endif // BOARD_HEADER

Doing it yourself, as iamthwee says, is best. Not only will you learn more, but you won't commit plagiarism. You needn't use graphics, as a text/console output is doable.

Comments
Well put.

i wud luv to do it myself. but i dunno where to start dis frm! give me an overall view of how to go about it...

>i wud luv to do it myself. but i dunno where to start dis frm!
Yea, don't do that anymore. Silly abbreviations make your posts harder to understand, especially for non-native English speakers.

Presumably you've been taught how to do this, or you're pretending to your teacher that you can. If you can't do it, tell your teacher that you feel you haven't been taught enough.

In short, go away and spend some time thinking about the ideas offered in this thread.

When you have got something come back here and we will be glad to answer your questions about the code you have written.

can i have the source code in c please or the link to website

Comments
No, go away and sponge off someone else.
If you can find a way to go back in time 3 years, by all means

can I have the source code in c
its due today!!!!!!!!!

I think you picked the wrong user name, my friend.

This article has been dead for over six months. Start a new discussion instead.