Write a 3D version (the game logic being 3D, not the visual representation) of the popular Connect Four game ( http://en.wikipedia.org/wiki/Connect_Four ) where the user can play against the computer. The user may freely chose the dimensions of the game board (width, height, depth) up to a limit of 10 x 10 x 10.
The computer must play an intelligent (probably even optimal) game, apart from its first move which should be random. Ideally a solution will be optimal and never lose. Like tic-tac-toe, perfect play should always result in a draw.
The first player to place four pieces in a row (vertically, horizontally, diagonally, .. (23 combinations in 3D)) wins.
Winner is shortest code.