Thursday, 13 November 2014

Coding the Final Prototype

Because there wasn't much difference in the code between the last two physical prototypes I spent a lot of practical time improving the code and making it more versatile.

I set the number of dots per column (dpc) and the number of dots per row (dpr) as variables.

This meant I could have the system work out how many mines there should be ( INT(dpc * dpr / 0.15)).  So the more dots the more mines.

The system also then had to be able to cope with working out which dots were on the edge of the mat for itself, so I put in a new variable in the twisterDot class and had the main class work out the location on the mat before it created the dot.

I also made it so that if the board had less than 4 columns the system would only use the number of colours are there were the number of columns.  So, if there are only 3 columns  only three colours are used.  There are only four colours total though, so if there are more than 4 columns, it still sticks to four colours.

I felt that these changes, while not changing anything in the tests allowed for more versatility in the long term and meant that the game variables could more easily be changed, if I so chose.

No comments:

Post a Comment