[Codewars] The learning game - Machine Learning #1

The learning game - Machine Learning #1

  • Time :
  • Space :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using namespace std;
class Machine {
private:
unordered_map<unsigned int, int> act;
unsigned int __cmd;

public:
unsigned int command(unsigned int cmd, unsigned int num) {
__cmd = cmd;
return get_action(act[__cmd])(num);
}
void response(bool res) {
if(!res) act[__cmd]++;
}
};
Author: Song Hayoung
Link: https://songhayoung.github.io/2023/06/07/PS/Codewars/the-learning-game-machine-learning-1/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.