Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== 9.3. Trees ===== 9.3.1. Implement a datatype for trees of integers. Write a function which checks if a tree is complete: <code haskell> isComplete :: IntTree -> Bool </code> 9.3.2. Write a function which flattens a tree to a list: <code haskell> flatten :: IntTree -> [Integer] </code> 9.3.3. The game Tic-Tac-Toe (or X and 0) is played on a three-by-three board of **positions**. Each position may be: free, with an X or with a 0. * write a ADT ''Position'' which encodes the value of each position. * write an ADT ''Board'' which encodes (using matrices) a 3-by-3 board of positions. * write a function which checks if either '''X''' or '''0''' have won (''won :: Char -> Board -> Bool'') Starting from a given (initial) board, we want to build **a tree** of all possible outcomes of the game. Example: <code> Parent node: X 0 0 0 X 0 Children (It is X-s turn to move): X 0 0 X 0 0 X 0 0 0 X X 0 X 0 X 0 X 0 0 X </code> 9.3.4.