1. ## Quick Question...

Satisfy my curiosity on this one:

I have more or less just started out learning C++. I am going through the tutorials on this site and I'm pretty much halfway through.
I continue learning and programming simple console applications every night I can, which averages out to about 2 hours a day.

About how long until I am able to program a Tetris clone from scratch? All I'm looking for is an estimation. Base it on your own experiance if you want.

Please note that I realize the amount of experiance I have is negligible. I am not expecting to hear that the answer in weeks. Nor am I feeling impatient. I am just curious.

2. Really the answer depends entirely on you. Because unless you are working towards makeing a tetris clone you will never do it. Search the forum for tetris, and you'll find sources and topics from people that have done it. Use their code to learn whats going on and try tomake your own. If you are dead set on making the clone, you could make one in 3 days easily.

3. Thanks

http://www.gamedev.net/reference/des...ames/page2.asp

I don't mean to be pushy, but a second answer would be appreciated. Take a look, and you may get an idea of what I mean. I'm sure I could rig together a tetris clone in a few days, but I think that for it to actually be a milestone in understanding, I need to be at a certain point in learning before undertaking the project.
So about how long until that point, or is it truly impossible to tell and I just have to be satisfied with that?

4. If you understand arrays you can program tetris.

Here is a simple way to draw the board - 10x10 tiles. I'm not sure the exact dimensions of a tetris board but we will go with 20 across by 50 down or 200x500 pixels.

Code:
```//This code assumes Board is a 2D array
//It could be a 1D accessed in 2D, but I didn't do it for clarity's
//sake
void DrawBoard(int startx,int starty)
{
int x=startx;
int y=starty;

int cellvalue=0;
int boxcolor=0;

for (int i=0;i<20;i++)
{
for (int j=0;j<50;j++)
{
boxcolor=Board[i][j];
DrawFilledBox(x,y,x+9,y+9,boxcolor);
x+=10;
}
x=startx;
y+=10;
}
}```

5. personally, i'd try doing this one on your own w/o looking at other people's work. ill give you a few hints tho. use a 3x3 character array to hold the X's and the 0's. then you can draw the rest of the board w/ little |'s. you can have the person enter the coordinates of where they want to place an X or O.

6. TicTacToe.h
Code:
```#ifndef _TICTACTOE_
#define _TICTACTOE_

#define ROWCOLTOMEM (row,col) ((row)*(3)+(col))

#define FAILURE 1
#define SUCCESS 0
#define EMPTY 0
#define FULL 1
#define XPIECE 1
#define YPIECE 2

class TicTacToe
{
protected:
unsigned char *Board;
int numslotsfree;
public:
TicTacToe(void);
~TicTacToe(void);
int Init(void);
unsigned char GetBoardValue(int row,int col);
int SetBoardValue(int row,int col);

//You figure these out
int CheckForWin(void)=0;
void SaveToDisk(void)=0;
};
#endif```
TicTacToe.cpp
Code:
```#include "TicTacToe.h"

TicTacToe::TicTacToe(void)
{
Board=0;
numslotsfree=0;
}

TicTacToe::~TicTacToe(void)
{
if (Board) delete [] Board;
}

int TicTacToe::Init(void)
{
numslotsfree=9;
Board=new unsigned char[9];
if (!Board) return FAILURE
else return SUCCESS;
}

unsigned char TicTacToe::GetBoardValue(int row,int col)
{
return Board[ROWCOLTOMEM(row,col)];
}

int TicTacToe::SetBoardValue(int row,int col,int value)
{
Board[ROWCOLTOMEM(row,col)]=value;
}```
Player.h
Code:
```#ifndef _PLAYER_
#define _PLAYER_

#include "TicTacToe.h"

class Player
{
protected:
unsigned char *name;
int piecevalue;
public:
Player(void);
~Player(void) {};
void Init(unsigned char *_name,int _piecevalue);
int Move(TicTacToe *_gameptr,int row,int col);
};
#endif```
Player.cpp
Code:
```#include "Player.h"

Player::Player(void)
{
name=0;
piecevalue=0;
}

void Player::Init(unsigned char * _name,int _piecevalue)
{
name=_name;
piecevalue=_piecevalue;
}

int Player::Move(TicTacToe *_gameptr,int row,int col)
{
int testvalue=gameptr->GetBoardValue(row,col);
if (testvalue==EMPTY)
{
gameptr->SetBoardValue(row,col,piecevalue);
return(SUCCESS);
} else return(FULL);
}```
That is a very good start for you.

7. I thought he said Tetris.

I am a newbie, like you. I found a great Tetris tutorial of step by step of how to make the game. It is the best that I have ever seen. I found it last night and I am basically moving along just like you.

http://triplebuffer.devmaster.net/ar...is_in_an_hour/

I haven't completely dug into it yet but I will soon.

For me, it would be nice to do it from scratch but I don't want to spend the rest of the month learning Tetris when by the end of the month I could be doing pong or another game and learning AI or soemthing.

8. It's not that I really desire to program tetris. All I want is to have an estimation as to how long it will be until I can actually understand how it works. For instance, that tutorial is all greek to me. All I have done so far is simple console applications.

9. I've been toying around with an equation that I think will answer your question.

Code:
```let c be equal to your competency level //(1[best] being john carmack, and any number higher less then bill gates by that many times. ie: 100 would be 100 times less competent)
let wastedTime = (((days spent asking how long it will take) / 24 ) /60) / 60)
let learnMins = (hours spent learning <insert language>)/60
let difficultyRatio = (difficulty rating / (1/c)) //1 would be guess numbers text game, 10000 would be unreal tourny 2004 or halflife 2, or quake 4

time(seconds)  = (15*difficultyRatio) - ((86400/learnMins)*60)+ wastedTime;

This is a serious equation. Assuming john carmack has 10 years experience with c/c++, 0 time wasted, a level 300 game (tetris), it would take him 15 minutes to make the game.
time(seconds) = (15*300) - (((86400/86400)*60)*60) + 0```

10. >let wastedTime = (((days spent asking how long it will take) / 24 ) /60) / 60)
>let learnMins = (hours spent learning <insert language>)/60
Bzzt. Wrong. You need to multiply, not divide. Geez. Basic math stuff here.

Also, your formula is completely b0rked.
>time(seconds) = (15*difficultyRatio) - ((86400/learnMins)*60)+ wastedTime;
So, if I spent 1 minute learning the language, making a difficulty 300 program, with no wasted time, it'd take me -5179500 seconds to write. Wow.

11. ...Interesting.

In a note of defense, I am still learning while asking my question. The wastedTime part seems flawed.

12. Originally Posted by XSquared
>Bzzt. Wrong. You need to multiply, not divide. Geez. Basic math stuff here.

So, if I spent 1 minute learning the language, making a difficulty 300 program, with no wasted time, it'd take me -5179500 seconds to write. Wow.

Seriously it was a joke. The idea was to say spend less time asking how long it will take, and more time actually doing it.

Heh, yeah the math was all fuxored. I wrote it in 30 seconds, more of a typo then anything dividing instead of multiplying. But either way its not important. The important thing is - get to work already.

13. Okay I saw X's and O's and just assumed we changed to Tic Tac Toe. Guess not.

Anyways you've got a great start for tic tac toe.