【发布时间】:2023-11-16 21:58:01
【问题描述】:
我想通过编辑以交互方式添加这个挂起:
@@ -55,3 +50,28 @@
{
- if(n_arguments == 1)
+ inputed_command = get_line(); //gets the user's input line from the stdin.
+
+ //we edit the user's input as needed according to qtp rules.
+ /*STRING EDITING FUNCTIONS*/
+ replace_string_chars(inputed_command, 9, ' ');
+ remove_char(inputed_command, 13);
+ remove_comments(inputed_command);
+ remove_extra_spaces(inputed_command);
+ uncapitalize(inputed_command);
+ /*END OF STRING EDITING FUNCTIONS*/
+
+ //the command gets seperated from the user's input ex. playmove w c3, here the command is playmove.
+ command = command_decode(inputed_command);
+ //the arguments are seperated from the user's input in an 2D array ex. playmove w c3, here the arguments are w and c3.
+ arguments = arguments_decode(inputed_command, &n_arguments);
+
+ //the user specified command is executed by matching the user's command with the engine's available commands. if the user's command is not one of the engine's known commands then a descriptive error is printed.
+ if(strcmp(command, "name") == 0)
+ name();
+ else if(strcmp(command, "known_command") == 0)
+ known_command(arguments, n_arguments);
+ else if(strcmp(command, "list_commands") == 0)
+ list_commands();
+ else if(strcmp(command, "quit") == 0)
+ quit(&quit_game);
+ else if(strcmp(command, "boardsize") == 0)
{
我只想上演这部分:
@@ -55,3 +50,28 @@
{
- if(n_arguments == 1)
+ inputed_command = get_line(); //gets the user's input line from the stdin.
+
+ //we edit the user's input as needed according to qtp rules.
+ /*STRING EDITING FUNCTIONS*/
+ replace_string_chars(inputed_command, 9, ' ');
+ remove_char(inputed_command, 13);
+ remove_comments(inputed_command);
+ remove_extra_spaces(inputed_command);
+ uncapitalize(inputed_command);
+ /*END OF STRING EDITING FUNCTIONS*/
+
+ //the command gets seperated from the user's input ex. playmove w c3, here the command is playmove.
+ command = command_decode(inputed_command);
+ //the arguments are seperated from the user's input in an 2D array ex. playmove w c3, here the arguments are w and c3.
+ arguments = arguments_decode(inputed_command, &n_arguments);
+
{
但是当我保存并退出时,会出现“补丁不适用”的错误。
我读到我需要编辑 @@ 字符之间的数字,但我从来没有做对。请描述一下如何解决这个错误,谢谢。
【问题讨论】:
标签: git add edit patch interactive