Hello andrea, > I was trying to code the classic tictactoe in ruby. > Now it only plays itself doing random moves until someone wins, and > there > are still some bugs. > > But the thing that really I don't understand is another, > > With this line every time I pick the next move: > > x, y = (0...(board.length)).to_a.choice, (0... > (board.length)).to_a.choice > > But I get always the same game!!: > > [snip] You should add a call to srand before the call to random_play. It will seed the random number generator so that you don't get the same sequence of random numbers every time you run your program. -- Fabio Aquotte