MCPcopy Create free account
hub / github.com/bupticybee/TexasSolver / processCommand

Method processCommand

src/tools/CommandLineTool.cpp:91–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90
91void CommandLineTool::processCommand(string input) {
92 vector<string> contents;
93 split(input,' ',contents);
94 if(contents.size() == 0) contents = {input};
95 if(contents.size() > 2 || contents.size() < 1)throw runtime_error(tfm::format("command not valid: %s",input));
96 string command = contents[0];
97 string paramstr = contents.size() == 1 ? "" : contents[1];
98 if(command == "set_pot"){
99 this->ip_commit = stof(paramstr) / 2;
100 this->oop_commit = stof(paramstr) / 2;
101 }else if(command == "set_effective_stack"){
102 this->stack = stof(paramstr) + this->ip_commit;
103 }else if(command == "set_board"){
104 this->board = paramstr;
105 vector<string> board_str_arr = string_split(board,',');
106 if(board_str_arr.size() == 3){
107 this->current_round = 1;
108 }else if(board_str_arr.size() == 4){
109 this->current_round = 2;
110 }else if(board_str_arr.size() == 5){
111 this->current_round = 3;
112 }else{
113 throw runtime_error(tfm::format("board %s not recognized",this->board));
114 }
115 }else if(command == "set_range_ip"){
116 this->range_ip = paramstr;
117 }else if(command == "set_range_oop"){
118 this->range_oop = paramstr;
119 }else if(command == "set_bet_sizes"){
120 vector<string> params;
121 split(paramstr,',',params);
122 if(params.size() < 3)throw runtime_error("param number error");
123 // oop,turn,bet,30,70,100
124 string player = params[0];
125 string round = params[1];
126 string bet_type = params[2];
127 StreetSetting& streetSetting = this->gtbs->get_setting(player,round);
128 vector<float>* sizes;
129 if(bet_type == "allin") streetSetting.allin = true;
130 else if(bet_type == "bet") sizes = &(streetSetting.bet_sizes);
131 else if(bet_type == "raise") sizes = &(streetSetting.raise_sizes);
132 else if(bet_type == "donk") sizes = &(streetSetting.donk_sizes);
133 else throw runtime_error("");
134
135 if(bet_type == "bet" || bet_type == "raise" || bet_type == "donk"){
136 sizes->clear();
137 for(int i = 3;i < params.size();i ++ ){
138 sizes->push_back(stof(params[i]));
139 }
140 }
141 }else if(command == "set_accuracy"){
142 this->accuracy = stof(paramstr);
143 }else if(command == "set_allin_threshold"){
144 this->allin_threshold = stof(paramstr);
145 }else if(command == "set_thread_num"){
146 this->thread_number = stoi(paramstr);
147 }else if(command == "build_tree"){
148 this->ps.build_game_tree(oop_commit,ip_commit,current_round,raise_limit,small_blind,big_blind,stack,*gtbs.get(),allin_threshold);

Callers 2

startWorkingMethod · 0.95
execFromFileMethod · 0.95

Calls 10

formatFunction · 0.85
string_splitFunction · 0.85
sizeMethod · 0.80
clearMethod · 0.80
push_backMethod · 0.80
build_game_treeMethod · 0.80
splitFunction · 0.70
getMethod · 0.45
trainMethod · 0.45
dump_strategyMethod · 0.45

Tested by

no test coverage detected