Assessment Arrays Medium
TicTacToe
Read a three by three lines of noughts and crosses ("O" and "X"). Print "true" if the crosses side has won the game; print false otherwise.
The test files used are:
- http://progzoo.net/array21.txt - X has won this game
XXX OOX XOO
- http://progzoo.net/array22.txt X has NOT won.
XOX OOX XOO
- http://progzoo.net/array23.txt X has won.
X X OOX OOX
- http://progzoo.net/array24.txt X has NOT won
O X OOX XXO
Magic Square
Read in four lines of four numbers separated by the tab character.
Print "true" if these form a “magic square”; print "false" otherwise. A magic square is one where all the number in each row, column and the diagonals add up to the same number:
The test files used are:
- http://progzoo.net/array26.txt This is NOT a magic square
16 2 3 13 9 6 7 12 5 11 10 8 4 14 15 1
- http://progzoo.net/array27.txt This IS a magic square
16 2 3 13 9 7 6 12 5 11 10 8 4 14 15 1
Perfect Module
Read in a list of marks from a file, each between 0 and 100. Print "true" if this represents the perfect module mark sheet and false otherwise. To be perfect a module must have a mean between 55 and 60 and a standard deviation between 5 and 15. No more than 10% may fail (less than 40) and no more than 20% may have merit (more than 64).