pp
Dependencies: mbed
Diff: Game.cpp
- Revision:
- 1:ba7154d2d7ca
- Child:
- 4:a61cdd4e7afa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Game.cpp Sat Dec 05 14:01:16 2015 +0000 @@ -0,0 +1,27 @@ +#include"Game.h" + +const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; +const bool bcd[16][4] = {{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{0,1,0,0},{0,1,0,1},{0,1,1,0},{0,1,1,1}, + {1,0,0,0},{1,0,0,1},{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},{1,1,1,1}}; + +char Game::gethex(int dec) +{ + return hex[dec]; +} +void Game::random() +{ + for(int i=0;i<n;i++) + { + //hexRandom[i] = random + } +} +void Game::hextobcd() +{ + for(int i=0;i<n;i++) + { + mybcd[i][0] = bcd[hexRandom[i]][0]; + mybcd[i][1] = bcd[hexRandom[i]][1]; + mybcd[i][2] = bcd[hexRandom[i]][2]; + mybcd[i][3] = bcd[hexRandom[i]][3]; + } +}