pp

Dependencies:   mbed

Committer:
NamSom
Date:
Sat Dec 05 14:01:16 2015 +0000
Revision:
1:ba7154d2d7ca
Child:
4:a61cdd4e7afa
qqq

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NamSom 1:ba7154d2d7ca 1 #include"Game.h"
NamSom 1:ba7154d2d7ca 2
NamSom 1:ba7154d2d7ca 3 const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
NamSom 1:ba7154d2d7ca 4 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},
NamSom 1:ba7154d2d7ca 5 {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}};
NamSom 1:ba7154d2d7ca 6
NamSom 1:ba7154d2d7ca 7 char Game::gethex(int dec)
NamSom 1:ba7154d2d7ca 8 {
NamSom 1:ba7154d2d7ca 9 return hex[dec];
NamSom 1:ba7154d2d7ca 10 }
NamSom 1:ba7154d2d7ca 11 void Game::random()
NamSom 1:ba7154d2d7ca 12 {
NamSom 1:ba7154d2d7ca 13 for(int i=0;i<n;i++)
NamSom 1:ba7154d2d7ca 14 {
NamSom 1:ba7154d2d7ca 15 //hexRandom[i] = random
NamSom 1:ba7154d2d7ca 16 }
NamSom 1:ba7154d2d7ca 17 }
NamSom 1:ba7154d2d7ca 18 void Game::hextobcd()
NamSom 1:ba7154d2d7ca 19 {
NamSom 1:ba7154d2d7ca 20 for(int i=0;i<n;i++)
NamSom 1:ba7154d2d7ca 21 {
NamSom 1:ba7154d2d7ca 22 mybcd[i][0] = bcd[hexRandom[i]][0];
NamSom 1:ba7154d2d7ca 23 mybcd[i][1] = bcd[hexRandom[i]][1];
NamSom 1:ba7154d2d7ca 24 mybcd[i][2] = bcd[hexRandom[i]][2];
NamSom 1:ba7154d2d7ca 25 mybcd[i][3] = bcd[hexRandom[i]][3];
NamSom 1:ba7154d2d7ca 26 }
NamSom 1:ba7154d2d7ca 27 }