Sha256: a4d7322f95a471de4189c5da19dc2d1d3b09bb7c7d7c0f0508cf1e6d6e30b53c
Contents?: true
Size: 473 Bytes
Versions: 2
Compression:
Stored size: 473 Bytes
Contents
module TresRaya class DumbPlayer < Player def move( board ) moves = board.moves moves[rand(moves.size)] end def finish( final_board ) # print final_board if final_board.won? == @mark # print "Congratulations, you win.\n\n" win = 1 elsif final_board.won? == " " # print "Tie game.\n\n" win = 0 else # print "You lost tic-tac-toe?!\n\n" win = -1 end win end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tres-raya-0.0.3 | lib/tres_raya/dumb_player.rb |
tres-raya-0.0.2 | lib/tres_raya/dumb_player.rb |