A method, system, apparatus and storage medium for a robot to position a chess set

By acquiring the current chessboard image and historical chessboard information, using deep learning and genetic algorithms to select the placement of pieces, and performing coordinate system transformation, the problem of intelligent robots repeatedly playing the same chessboard is solved, thus achieving diversity in chessboards and improving teaching effectiveness.

CN117036664BActive Publication Date: 2026-05-12GUANGDONG VOCATIONAL & TECHNICAL COLLEGE
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG VOCATIONAL & TECHNICAL COLLEGE
Filing Date
2023-08-15
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing technologies, intelligent robots tend to repeatedly search for the same move point when facing the same chessboard, causing users and robots to repeatedly play the same game, which lacks a real teaching effect.

Method used

By acquiring the current chessboard image and historical chess game information, multiple candidate move positions are selected using deep learning and genetic algorithms. Coordinate system transformation is then used to ensure that the robot makes the move in the correct position, avoiding repeated chess games.

Benefits of technology

This effectively avoids the situation of placing the same piece on the same board, increases the diversity of game situations and the teaching effect, and enhances the user's game experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117036664B_ABST
    Figure CN117036664B_ABST
Patent Text Reader

Abstract

The application discloses a kind of robot positioning chess game method, system, device and storage medium, method includes obtaining current chessboard image, corresponding current chessboard information is identified by current chessboard image, judge whether current chessboard information exists in at least one historical chess game information, if yes, the historical chess game information that exists current chessboard information is screened out, according to the historical chess game information screened out, obtain multiple and current chessboard information corresponding candidate landing position;According to multiple candidate landing position, determine the first landing position matched with current chessboard information, and control robot according to the first landing position and drop the ball.The application can effectively avoid the same chessboard when facing the repeated situation of the landing point found, reduce the repeatability of the chess game while protecting the diversity of the chess game, can effectively improve the effect of the chess game and the chess game experience of user, satisfy the diversity demand of most players to man-machine chess game.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game control technology, and in particular to a method, system, device, and storage medium for robot positioning in a game. Background Technology

[0002] Go, a strategy-based two-player board game, was called "Yi" in ancient China. It is played on a rectangular grid board with black and white circular stones. A standard Go board has 19 vertical and 19 horizontal lines, with 361 intersections. Stones must be placed on empty intersections that are not forbidden. Players take turns making moves, and once a stone is placed, it cannot be moved or taken back. The player with the higher score wins.

[0003] With the development of artificial intelligence, intelligent robots have emerged on the market. Playing against these robots allows users to improve their chess skills. Finding the optimal move point is a crucial step in this process. However, since most current search algorithms aim for the best possible move, they often find the same move point repeatedly when facing the same board. This results in the user and robot repeatedly playing the same game, negating the true educational effect. Summary of the Invention

[0004] The purpose of this invention is to provide a method, system, apparatus, and storage medium for locating chess positions using a robot, in order to solve one or more technical problems existing in the prior art, or at least provide a beneficial option or create conditions.

[0005] The solution to the technical problem of this invention is as follows: In a first aspect, embodiments of this invention provide a method for a robot to locate a chess game, comprising the following steps:

[0006] Obtain the current chessboard image, and identify the corresponding current chessboard information through the current chessboard image;

[0007] Obtain several historical game information entries, and determine whether the current game information exists in at least one of the historical game information entries; if so, proceed to the next step.

[0008] Filter out the historical game information that contains the current game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information;

[0009] Based on the multiple candidate placement positions, a first placement position matching the current chessboard information is determined, and the robot is controlled to place a piece according to the first placement position.

[0010] As a further improvement to the above technical solution, the method further includes: when it is determined that the current chess board information does not exist in at least one of the historical chess board information, determining a second move position that matches the current chess board information based on the current chess board information, and controlling the robot to make a move based on the second move position.

[0011] As a further improvement to the above technical solution, the steps for controlling the robot to place pieces according to their placement position include:

[0012] The coordinates of the placement position on the current board are determined, which is the first coordinate information;

[0013] A first transformation relationship is established between the chessboard coordinate system and the camera coordinate system. The first coordinate information is converted into second coordinate information through the first transformation relationship. The second coordinate information is the coordinate information of the placement position in the camera coordinate system.

[0014] A second transformation relationship between the camera coordinate system and the robot coordinate system is established. The second coordinate information is converted into third coordinate information through the second transformation relationship. The third coordinate information is the coordinate information of the placement position in the robot coordinate system.

[0015] As a further improvement to the above technical solution, the step of controlling the robot to place the piece according to the placement position also includes:

[0016] Based on the third coordinate information, a move instruction is generated and sent to the robot. The move instruction carries the third coordinate information so that the robot controls its robotic arm to place the piece at the move position according to the move instruction.

[0017] As a further improvement to the above technical solution, the placement position includes either a first placement position or a second placement position.

[0018] As a further improvement to the above technical solution, before identifying the corresponding current chess board information through the current chess board image, the method further includes: performing image preprocessing on the current chess board image.

[0019] In a second aspect, embodiments of the present invention provide a system for locating a chess game using a robot, comprising:

[0020] The acquisition unit is used to acquire the current chessboard image;

[0021] The chessboard recognition unit is used to identify the corresponding current chessboard information through the current chessboard image;

[0022] A game state judgment unit is used to acquire several historical game state information and determine whether the current game state information exists in at least one of the historical game state information.

[0023] The position selection unit is used to filter out the historical game information that contains the current game information when the current game information exists in at least one of the historical game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information.

[0024] The first position determination unit is used to determine a first position that matches the current chessboard information based on a plurality of candidate position selections.

[0025] The first control unit is used to control the robot to place the piece according to the first placement position.

[0026] As a further improvement to the above technical solution, the system also includes:

[0027] The second position determination unit is used to determine a second move position matching the current chess board information based on the current chess board information when it is determined that the current chess board information does not exist in at least one of the historical chess board information.

[0028] The second control unit is used to control the robot to place the piece according to the second placement position.

[0029] Thirdly, embodiments of the present invention provide a device for locating a chess game by a robot, comprising:

[0030] At least one processor;

[0031] At least one memory for storing at least one program;

[0032] The method for locating a robot chess game is implemented when at least one of the programs is executed by at least one of the processors.

[0033] Fourthly, embodiments of the present invention provide a storage medium storing processor-executable instructions, which, when executed by a processor, are used to perform the aforementioned method for locating a robot in a chess game.

[0034] The beneficial effects of this invention are: it provides a method, system, device and storage medium for robot positioning in chess games, which can effectively avoid the repetition of the moves found when facing the same chess board. While reducing the repetitiveness of chess games, it also protects the diversity of chess games, effectively improves the game effect and the user's game experience, and meets the diverse needs of most chess players for human-computer chess games.

[0035] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description

[0036] Figure 1 A flowchart illustrating a method for locating a chess game using a robot, as provided in this application embodiment;

[0037] Figure 2 A flowchart illustrating the generation process of current chessboard information provided in this application embodiment;

[0038] Figure 3 A flowchart for determining whether there is current chess information in at least one historical chess game information provided in the embodiments of this application;

[0039] Figure 4 A flowchart of one of the matching steps provided in an embodiment of this application;

[0040] Figure 5 A second flowchart of the matching steps provided in the embodiments of this application;

[0041] Figure 6 This is a control flowchart for the robot to place pieces, provided in an embodiment of this application.

[0042] Figure 7 This is a structural diagram of a robot-based chess game system provided in an embodiment of this application. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0044] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.

[0045] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0047] With the continuous improvement of living standards in my country, people's demand for leisure and entertainment is also constantly growing, leading to the rapid development of various online and mobile games. Board games, being intellectually stimulating games that can train thinking skills, are widely loved. Board games include two-player and multiplayer games; the former leans towards competition, while the latter leans towards entertainment. Go, an intellectual game originating in China, has been played on a flat surface for thousands of years. Because of its edges and corners—three liberties at intersections on the edges and two liberties at intersections in the corners—the edges and corners possess unique characteristics in the game, forming many large and varied joseki (open patterns), contributing to the complexity of Go.

[0048] Go is played on a rectangular grid board with black and white circular stones. A standard Go board has 19 vertical and 19 horizontal lines, with 361 intersections, also called positions. Stones must be placed on empty intersections that are not forbidden moves. Black and white stones are used, and players take turns making moves. Once a stone is placed, it cannot be moved or taken back. The player with the higher score wins. Specific Go terminology is as follows:

[0049] A piece's "liberties" refer to the empty points directly adjacent to it on the board. If there are other pieces of the same color directly adjacent to a piece, they are connected and form an inseparable unit. Their liberties are also counted. If there are pieces of a different color directly adjacent to a piece, that piece loses its liberty.

[0050] "Taking a piece" refers to a move by one player that leaves the opponent's piece with only one liberty. This move is called "taking a piece," meaning that the player can capture the opponent's piece on their next move.

[0051] Capturing a piece occurs when a group of stones loses all its liberties to the opponent and is removed from the board. In other words, when a player's move results in an opponent's piece losing all its liberties, this move is called "capturing," and all captured pieces must be removed from the board. Specifically, if both players' pieces are now without liberties after a move, only the opponent's pieces without liberties should be captured.

[0052] A forbidden point is any point on the chessboard where, if a player moves a piece that immediately loses all its liberties (no liberties) and cannot capture any opponent's pieces, it is considered an invalid move. Essentially, neither player can make a move that leaves their own pieces without liberties; otherwise, the move is null and void.

[0053] Prohibiting identical positions across the entire board means preventing a situation that has already occurred in the previous game from happening again.

[0054] The final game result determination refers to the process at the end of the game where, according to the rules, dead stones are first removed, and then the points and stones are added together to see if the total points (the number of points Black should have won) or the total points (the number of points White should have won) are reached, thus determining the winner.

[0055] As can be seen, a move consists of: placing the player's piece on an intersection; and if the move can capture an opponent's piece, removing the captured piece from the board.

[0056] With the development of artificial intelligence, intelligent robots have emerged on the market. Playing against these robots allows users to improve their chess skills. Finding the optimal move point is a crucial step in this process. However, since most current search algorithms aim for the best possible move, they often find the same move point repeatedly when facing the same board. This results in the user and robot repeatedly playing the same game, negating the true educational effect.

[0057] To address the problems existing in the aforementioned related technologies, this application proposes a method, system, device, and medium for robot-based chess game positioning, which overcomes the situation where the moves found are repeated when facing the same chess game, ensures the diversity of chess games, and achieves a true chess game teaching effect.

[0058] The following will describe in detail, with reference to the accompanying drawings, a method for locating a chess game using a robot according to an embodiment of the present invention.

[0059] The method provided in this invention can be applied to terminals, servers, or software running on either terminal or server. Terminals can be tablets, laptops, desktop computers, etc., but are not limited to these. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0060] Reference Figure 1 The method proposed in this embodiment of the invention may include, but is not limited to, the following steps:

[0061] S101, Obtain the current chessboard image, and identify the corresponding current chessboard information through the current chessboard image.

[0062] In this step, the image acquisition module of the chessboard robot is used to acquire images of the chessboard surface to obtain the current chessboard image. Then, deep learning algorithms are used to segment and recognize the chessboard image to obtain the corresponding chessboard information.

[0063] S102: Obtain several historical game information entries and determine whether the current game information exists in at least one historical game information entry. If so, proceed to S103.

[0064] It should be noted that a game consists of at least one board.

[0065] In this step, the start time of the current game is taken as the current moment. Historical games refer to one or more games that occurred before the current moment. By obtaining historical game information and judging the inclusion relationship between it and the current game information, the occurrence of the current game in past games can be determined.

[0066] S103, filter out historical game information that contains current game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information;

[0067] S104: Based on multiple candidate placement positions, determine the first placement position that matches the current board information, and control the robot to place a piece according to the first placement position.

[0068] In this step, a genetic algorithm is used to combine multiple candidate placement positions to obtain the first placement position.

[0069] In some embodiments of the present invention, if the current chess face information does not exist in at least one historical chess game information, that is, one or more historical chess games do not contain the current chess face, the following steps are performed:

[0070] S105: Based on the current board information, determine the second move position that matches the current board information, and control the robot to make a move based on the second move position.

[0071] In this step, a search algorithm is used in conjunction with the current board information to determine the second move position.

[0072] In some embodiments of the present invention, before recognizing the current chessboard image, an image preprocessing step is included. Specifically, the image preprocessing step may include, but is not limited to:

[0073] First, the current chessboard image is processed into grayscale to obtain the first image.

[0074] It should be noted that grayscale conversion is defined as converting a three-channel color image into a single-channel grayscale image. The grayscale conversion operation used in this application is luminance grayscale conversion. In the YUV color space, the physical meaning of the Y component is the brightness of a point, and this value reflects the brightness level. Based on the relationship between the RGB and YUV color spaces of an image, a correspondence between the brightness Y and the three color components R, G, and B can be established, and this brightness value is used to express the grayscale value of the image.

[0075] Then, the first image is thresholded to obtain the second image.

[0076] In this step, since white Go stones are brighter than other areas and black Go stones are darker than other areas, this characteristic is utilized to identify the Go stones on the board using shadow and bright areas as features. This embodiment of the invention sets brightness and darkness thresholds, and uses threshold operations to process the image. Pixels brighter than the brightness threshold are enhanced, while pixels darker than the darkness threshold are dimmed. Pixels between the brightness and darkness thresholds are left unprocessed, thus obtaining the second image.

[0077] Furthermore, the second image is segmented into multiple sub-blocks, and noise is reduced on these sub-blocks.

[0078] It should be noted that the size of each sub-block is defined as m*n, where m is the width of the sub-block and n is the height of the sub-block, and the values ​​of m and n are within a preset pixel range.

[0079] In this step, a noise reduction algorithm is used for each sub-block to perform preliminary noise reduction processing, in order to eliminate the noise contained in each sub-block. The noise reduction algorithms include the BEEPS algorithm, median filtering algorithm, mean filtering algorithm, bilateral filtering algorithm, joint bilateral filtering algorithm, and guided filtering algorithm. The purpose of this step is to reduce the negative impact of noise in each pixel region of the image data on the performance of subsequent recognition models, improve the smoothness of each pixel region, and preserve as much of the original feature information of each pixel region as possible.

[0080] Optionally, after processing the sub-block with the denoising algorithm, the sub-block is further subjected to third-order denoising using the Savitzky-Golay algorithm to obtain the denoised sub-block.

[0081] It's important to note that the Savitzky-Golay algorithm, also known as the Savitzky-Golay filter or SG filter, is widely used for data stream smoothing and noise reduction. It's a filtering method based on local polynomial least squares fitting in the time domain. The biggest advantage of the SG filter is that it can remove noise while maintaining the shape and width of the signal. Furthermore, the effectiveness of SG smoothing varies depending on the selected window width, thus meeting the needs of various applications.

[0082] Finally, the denoised sub-blocks are integrated to obtain the preprocessed current chessboard image.

[0083] In some embodiments of the present invention, reference is made to... Figure 2 Step S101 uses a deep learning algorithm to identify the preprocessed current chessboard image to obtain the current chessboard information, which mainly includes the following steps:

[0084] The first step is to use image segmentation to segment the preprocessed current chessboard image so that the segmented image retains only the necessary chessboard grid lines and chess piece information.

[0085] Optionally, the image segmentation model is a neural network model based on a fully convolutional neural network.

[0086] In this embodiment of the invention, only the intersections of the chessboard lines and the pieces located at those intersections are needed, while other off-field information and background information resembling the chessboard are considered features that do not require attention. Based on this idea, the image can be segmented so that the processed image retains only the necessary chessboard grid lines and piece information. To this end, this step uses a fully convolutional neural network to segment the chessboard image, separating the chessboard lines and pieces from other features that do not require attention.

[0087] The second step is to perform dilation processing on the segmented current chessboard image.

[0088] In this embodiment of the invention, although the general outline of the chessboard lines is successfully detected, the chessboard lines have a certain width in the chess image. This causes the detected edges to be distributed on both sides of the chessboard lines, resulting in some false edges and missing edges. To address this defect in image segmentation, this step uses a dilation operation to merge the edges on both sides of the chessboard lines, making them a single, complete edge line. This connects two previously disconnected regions, thereby ensuring the accuracy and integrity of the chessboard lines.

[0089] The third step is to construct a chessboard coordinate system using the center pixel of the segmented current chessboard image as the origin, and determine the coordinate information of each chess piece in the current chessboard image in the chessboard coordinate system, which is recorded as chess piece coordinates. One or more chess piece coordinates constitute the current chessboard information.

[0090] It is understandable that the current board information is the current board set, which contains the coordinates of multiple pieces.

[0091] In some embodiments of the present invention, reference is made to... Figure 3 In step S102, the step of determining whether the current board information exists in at least one historical board information mainly includes:

[0092] S201, retrieve information on multiple historical chess games.

[0093] In this step, each historical game information includes one or more historical game pieces, and each historical game piece consists of one or more historical coordinates of pieces. It can be understood that each historical game information is a total set, which contains multiple subsets, and each subset contains a corresponding element, namely one or more historical coordinates of pieces.

[0094] S202, perform a matching step once for each historical chess face information for each historical chess game information to determine whether the historical chess face information matches the current chess face information.

[0095] S203, when the matching step has been completed for every historical board position in all historical game information, if the historical board position of at least one historical game information matches the current board position, then it is determined that the current board position exists in at least one historical game information. Furthermore, if no historical board position in any historical game information matches the current board position, then it is determined that the current board position does not exist in any historical game information.

[0096] In the above steps, each historical board position in each historical game information is compared and matched with the current board position information in turn, and the following matching results exist:

[0097] If any historical game information contains a historical board information that matches the current board information, then the current board information is determined to exist in that historical game information, the matching step for that historical game information is terminated, and each historical board information in the next historical game information is matched with the current board information in turn.

[0098] When all historical chess pieces in any historical chess game information do not match the current chess piece information, the matching step for that historical chess game information ends. At the same time, it is determined that the current chess piece information does not exist in that historical chess game information, and each historical chess piece information in the next historical chess game information is matched with the current chess piece information in turn.

[0099] If the historical board information in all historical game information does not match the current board information, then it is determined that the current board information does not exist in any historical game information.

[0100] If, among all the historical game information, there exists at least one historical game information that matches the current game information, then the current game information is determined to exist in at least one historical game information.

[0101] This is used to determine whether the current board information exists in at least one historical board information.

[0102] As a further implementation method, refer to Figure 4 and Figure 5 For each historical board position in each historical game, the matching process mainly includes the following steps:

[0103] Step 1: Obtain the coordinates of one or more pieces in the current chessboard information, calculate the hash value of each piece coordinate, and use the sequence of hash values ​​of each piece coordinate as the first hash sequence.

[0104] It should be noted that the elements of the first hash sequence are the hash values ​​of at least one piece coordinate of the current chessboard information.

[0105] Step 2: Obtain the historical coordinates of one or more pieces from the current historical chess information, calculate the hash value of each piece's historical coordinates, and use the sequence of hash values ​​of each piece's historical coordinates as the second hash sequence.

[0106] It should be noted that the elements of the second hash sequence are the hash values ​​of at least one piece coordinate of the current historical chessboard information.

[0107] Step 3: Using the first hash sequence as a substring and the second hash sequence as the original string, determine whether the first hash sequence has at least one element that appears for the first time in the second hash sequence.

[0108] If so, then all elements of the first hash sequence that have their first occurrence in the second hash sequence are taken as existing elements. Then, the proportion of existing elements among all elements in the first hash sequence is calculated and recorded as the first proportion value, and then proceed to step 4.

[0109] If not, the current board information does not match the current historical board information, and the process proceeds to matching the next historical board information. The next historical board information is used as the current historical board information, and the process returns to step 1.

[0110] Step 4: Construct a Bloom filter based on the second hash sequence.

[0111] In this step, a Bloom filter with multiple points is constructed. The number of points is the same as the number of elements in the second hash sequence. Each element of the second hash sequence is stored in the corresponding point of the Bloom filter.

[0112] Step 5: Map each element of the first hash sequence to a Bloom filter.

[0113] In this step, all elements of the first hash sequence are treated as a hash set. Each hash value is mapped to a Bloom filter using multiple hash functions. The bit values ​​of the ranges of successfully mapped Bloom filters are changed from 0 to 1, while the bit values ​​of other ranges that do not constitute a mapped Bloom filter remain at 0.

[0114] It is understandable that this step is a data query step, that is, to query whether the elements of the second hash sequence exist in the Bloom filter, and to determine which specific elements of the second hash sequence exist in the Bloom filter.

[0115] Step 6: Calculate the similarity between the elements of the first hash sequence successfully mapped to the Bloom filter and the points mapped in the Bloom filter.

[0116] It's important to note that a traditional Bloom filter is a bit array. In a Bloom filter, when an element is added to the set, it is mapped to K points in the bit array using K hash functions, and these points are set to 1. When any one of the K points has a bit value of 0, the element being tested definitely does not exist; conversely, when all K points have a bit value of 1, the element may or may not exist. This is because when multiple data points need to be stored in the Bloom filter, a situation may arise where the value of a previous element is overwritten by the value of a subsequent element on a certain bit, leading to the aforementioned result.

[0117] In this step, the drawbacks caused by the same hash value in different data blocks are eliminated. After obtaining the preliminary results of the data query in step 6, the similarity is calculated to determine the elements in the Bloom filter that actually have the second hash sequence, so as to make up for the defects of the traditional Bloom filter in data query.

[0118] Optionally, the similarity between the two can be calculated using Euclidean distance, Hamming distance, or other similar methods.

[0119] Step 7: Using all elements that are successfully mapped to the first hash sequence of the Bloom filter with a similarity greater than the similarity threshold as query elements, determine whether the number of query elements is greater than or equal to the number threshold.

[0120] If so, calculate the proportion of the query element among all elements in the first hash sequence, denoted as the second proportion, and proceed to step 8.

[0121] If not, the current board information does not match the current historical board information, and the process proceeds to matching the next historical board information. The next historical board information is used as the current historical board information, and the process returns to step 1.

[0122] Step 8: Assign the first weight to the first percentage value, assign the second weight to the second percentage value, calculate the sum of the first percentage value with the first weight and the second percentage value with the second weight, and record the sum as the chessboard existence coefficient.

[0123] Step 9: Determine whether the existence coefficient of the chess board is greater than the existence threshold.

[0124] If so, the current board information is matched with the current historical board information. The historical board information of the matched current historical board information is recorded as the historical board information containing the current board information. The next historical board information is taken as the current historical board information, and the above matching steps are performed on the historical board information contained therein.

[0125] It should be noted that only when the existence coefficient of the chess face in step 9 is greater than the existence threshold is the current chess face information considered to match the current historical chess face information, that is, the current historical chess face information is consistent with the current chess face information. At this time, the historical chess game information to which the current historical chess face information belongs is output, the matching step of the historical chess game information ends, and the matching step of the next historical chess game information begins. The above matching steps are performed sequentially for each historical chess face information of the next historical chess game information.

[0126] If not, the current board information does not match the current historical board information. The next historical board information will be used as the current historical board information, and the process will return to step 1.

[0127] It should be noted that when the existence coefficient of the chess face in step 9 is less than or equal to the existence threshold, it is considered that the current chess face information does not match the current historical chess face information. However, since other historical chess face information of the historical chess game information has not yet been compared, the matching of the next historical chess face information is then performed, and the above matching steps are executed on the next historical chess face information of the same historical chess game information.

[0128] In some embodiments of the present invention, the specific implementation process of step S103 is as follows:

[0129] S301 pre-collects the placement positions of each historical chess piece in multiple historical games and constructs a placement database based on these placement positions.

[0130] It should be noted that in the move database, the relationship between move positions and historical board positions is many-to-one. That is, the same historical board position has multiple move positions.

[0131] S302, based on the move database and combined with at least one selected historical game information, obtain multiple initial move positions corresponding to the historical game information of the at least one selected historical game information.

[0132] The aforementioned step S102 has determined that the current chess face information exists in at least one historical chess game information. This step filters out the historical chess game information that contains the current chess face information. The historical chess game information contains a historical chess face information that is consistent with the current chess face information. Using the historical chess face information of the historical chess game information as an index, multiple initial move positions corresponding to each historical chess face information are found from the move database.

[0133] It should be noted that different historical chess positions may correspond to the same initial move.

[0134] S303, calculate the frequency of each initial move position in all historical move positions, and select multiple initial move positions with a frequency lower than the frequency threshold as candidate move positions corresponding to the current move information based on the frequency.

[0135] In this step, by filtering out some initial placement positions that appear too frequently, the repetition rate of placement points when facing the same board is reduced, so as to avoid the situation of repeatedly playing the same game.

[0136] In some embodiments of the present invention, step S104 mainly includes the following steps:

[0137] S401, encodes several candidate placement positions according to a preset encoding method.

[0138] It should be noted that the process of expressing chromosomes as genes is called encoding, and common encoding formats include binary encoding and floating-point encoding.

[0139] S402, Set the population size and initialize the population to form an initial population. Each individual in the initial population is located within a preset feasible region.

[0140] It should be noted that the initial population is a randomly selected set of valid candidate solutions (individuals). Since the genetic algorithm uses chromosomes to represent each individual, the initial population is actually a set of chromosomes. In this embodiment of the invention, the initial population contains several chromosomes, which are the encoded candidate placement positions.

[0141] S403, calculate the fitness value of each individual in the current population.

[0142] Furthermore, the steps for calculating the fitness value of each individual in the current population specifically include: predicting the probability of winning the current game with each candidate move position through a neural network model, and using the probability as the fitness value of each individual in the current population.

[0143] It should be noted that the BP neural network model is a pre-trained neural network model. Its input is the position information of each candidate move in the chessboard coordinate system, and its output is the probability of winning the current game.

[0144] S404, determine whether the genetic algorithm meets the termination condition.

[0145] It should be noted that this invention uses a pre-specified generation (Gen) termination criterion to end the algorithm. Other termination criteria may be used in other embodiments of this invention. Several termination criteria can be used to determine whether the algorithm can stop. Two of the most commonly used termination criteria are: ① The maximum number of generations has been reached, which also limits the running time and computational resources consumed by the algorithm. ② There has been no significant improvement in the individual over the past few generations. This can be achieved by storing the best fitness value obtained in each generation and then comparing the current best value with the best value obtained several generations ago. If the difference is less than or greater than a certain threshold, the algorithm can stop.

[0146] If yes, proceed to the next step; otherwise, use the roulette wheel selection method to select and eliminate individuals from the current population, and perform crossover and mutation operations on the individuals in the eliminated population to generate a new population, and return to the previous step.

[0147] It's important to note that applying the genetic operators of selection, crossover, and mutation to a population produces a new generation based on the better individuals from the current generation. Specifically: the selection operation is responsible for choosing dominant individuals from the current population. The crossover operation, also known as recombination, creates offspring from selected individuals, typically by exchanging parts of their chromosomes between two selected individuals to create two new chromosomes representing the offspring. The mutation operation randomly changes one or more chromosome values ​​(genes) in each newly created individual; mutations usually occur with a specific probability.

[0148] S405: Select the individual with the highest fitness value in the current population as the optimal individual, and decode the optimal individual according to the encoding method to obtain the first move position. Control the robot to make the move according to the first move position.

[0149] In some embodiments of the present invention, step S105 specifically includes: determining a second move position that matches the current chessboard information using a search algorithm based on the current chessboard information, and controlling the robot to make a move based on the second move position.

[0150] Optionally, the search algorithm includes any one of the following: game tree search algorithm, maximum and minimum search algorithm, alpha-beta pruning algorithm, or MCTS tree search algorithm.

[0151] In some embodiments of the present invention, step S104 includes controlling the robot to place a piece according to a first placement position, and step S105 includes controlling the robot to place a piece according to a second placement position. The placement position defined in the embodiments of the present invention includes either the first placement position or the second placement position.

[0152] Reference Figure 6 The process of controlling the robot to place pieces according to their location mainly includes the following steps:

[0153] First, determine the coordinates of the placement position on the current board, that is, the coordinates of the placement position in the board coordinate system, which is denoted as the first coordinate information.

[0154] It should be noted that the chessboard coordinate system is a coordinate system with the center pixel of the segmented current chessboard image as the origin.

[0155] Then, a first transformation relationship between the chessboard coordinate system and the camera coordinate system is constructed, and the first coordinate information is converted into the second coordinate information through the first transformation relationship.

[0156] It should be noted that the second coordinate information is the coordinate information of the placement position in the camera coordinate system.

[0157] Secondly, a second transformation relationship between the camera coordinate system and the robot coordinate system is constructed, and the second coordinate information is converted into third coordinate information through the second transformation relationship.

[0158] It should be noted that the third coordinate information is the coordinate information of the placement position in the robot coordinate system.

[0159] In this embodiment of the invention, the placement position refers to the coordinate position information of the piece on the chessboard. Therefore, the placement position must be located in the chessboard coordinate system, while the movement of the chess-playing robot is based on its robotic arm, and the robot's movement is located in the robot coordinate system. If the robot directly places the piece based on the coordinate information of the placement position, the difference in the measurement benchmarks between the robot coordinate system and the chessboard coordinate system may lead to the piece landing in the wrong position, resulting in an unsatisfactory playing effect.

[0160] To address the coordinate system registration problem, this invention proposes a coordinate system transformation and registration technique. First, the coordinates of the move's position in the chessboard coordinate system are converted to coordinates in the camera coordinate system, making the move's position initially close to the robot coordinate system. The camera coordinate system refers to the coordinate system of the image acquisition module mounted on the robot. Since both the image acquisition module and the robotic arm are located on the robot, the camera coordinate system and the robot coordinate system are the closest. Second, the coordinates of the move's position in the camera coordinate system are converted to coordinates in the robot coordinate system, ensuring complete registration between the move's position and the robot coordinate system. This invention reduces the gap between the actual and ideal move positions, achieving precise move placement and resulting in a more ideal gaming experience.

[0161] In addition, the process of controlling the robot to place pieces according to their placement position can also include the following steps:

[0162] Based on the third coordinate information, a move instruction is generated and sent to the robot, so that the robot can control its robotic arm to place the piece at the move position according to the move instruction.

[0163] It should be noted that the move command carries third coordinate information.

[0164] Reference Figure 7 The present invention also proposes a system for locating a chess game by a robot, which mainly includes:

[0165] The acquisition unit is responsible for acquiring the current chessboard image.

[0166] The chessboard recognition unit is responsible for identifying the corresponding chessboard information from the current chessboard image.

[0167] The game state judgment unit is responsible for acquiring several historical game state information and determining whether the current game state information exists in at least one historical game state information.

[0168] The position selection unit is used to filter out historical game information that contains the current game information when the current game information exists in at least one historical game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information.

[0169] The first position determination unit is responsible for determining the first position that matches the current board information based on multiple candidate positions.

[0170] The first control unit controls the robot to place pieces according to the first placement position.

[0171] As a further implementation, the system also includes:

[0172] The second position determination unit is used to determine the second move position that matches the current board information when it is determined that the current board information does not exist in at least one historical board information.

[0173] The second control unit controls the robot to place pieces according to the second placement position.

[0174] The content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0175] In addition, embodiments of the present invention also provide a device for locating a chess game by a robot, comprising:

[0176] At least one processor;

[0177] At least one memory for storing at least one program;

[0178] The above-described method for locating a robot in a chess game is implemented when at least one of the programs is executed by at least one of the processors.

[0179] Similarly, the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0180] This invention also provides a storage medium storing processor-executable instructions, which, when executed by a processor, are used to perform the aforementioned method for locating a robot in a chess game.

[0181] Similarly, the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0182] This invention matches and compares the current board position with the board positions of multiple historical games to determine if the current board position has appeared in previous games. Based on the occurrence of the current board position, different search techniques are used to determine the robot's move position. Specifically, if the current board position has appeared in previous games, multiple low-frequency candidate move positions are initially selected based on the frequency of occurrence, and the optimal move position is determined using a genetic algorithm with the probability of winning as the fitness value. If the current board position has not appeared in previous games, a search algorithm is used to determine the move position.

[0183] This invention effectively avoids the repetition of moves found when facing the same board, reducing the repetitiveness of games while preserving their diversity. This significantly improves the game's effectiveness and user experience, meeting the diverse needs of most players in human-computer interaction. Furthermore, the genetic algorithm, using the probability of winning as the fitness value, determines the optimal move position, effectively improving the accuracy of the AI ​​game and increasing the difficulty of human-computer interaction to satisfy players' demands for challenging games.

[0184] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.

[0185] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0186] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.

[0187] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0188] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0189] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0190] The step numbers in the above method embodiments are set only for ease of explanation and do not limit the order of the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

Claims

1. A method for locating a chess game using a robot, characterized in that, Includes the following steps: Obtain the current chessboard image, and identify the corresponding current chessboard information through the current chessboard image; Obtain several historical game information entries, and determine whether the current game information exists in at least one of the historical game information entries; if so, proceed to the next step. Filter out the historical game information that contains the current game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information; Based on the multiple candidate placement positions, a first placement position matching the current chessboard information is determined, and the robot is controlled to place a piece according to the first placement position; The step of determining whether the current board information exists in at least one of the historical board information includes: For each historical board position in each historical game, a matching step is performed once to determine whether the historical board position matches the current board position. When the matching step has been completed for every historical chess face information of all historical chess game information, if the historical chess face information of at least one historical chess game information matches the current chess face information, then it is determined that the current chess face information exists in at least one historical chess game information. Specifically, for each historical board position in each historical game, the matching step includes: Obtain the coordinates of one or more chess pieces in the current chessboard information, calculate the hash value of each chess piece coordinate, and use the sequence of hash values ​​of each chess piece coordinate as the first hash sequence; Obtain the historical coordinates of one or more pieces from the current historical chess information, calculate the hash value of each historical coordinate of the piece, and use the sequence of hash values ​​of each historical coordinate of the piece as the second hash sequence; Determine whether at least one element in the first hash sequence has a first occurrence position in the second hash sequence; if so, then all elements in the first hash sequence that have a first occurrence position in the second hash sequence are taken as existing elements, calculate the proportion of the existing elements among all elements in the first hash sequence, record it as the first proportion value, and proceed to the next step; otherwise, proceed to the next matching of the historical chess information. Construct a Bloom filter based on the second hash sequence; Map each element of the first hash sequence to the Bloom filter; Calculate the similarity between the elements of the first hash sequence that are successfully mapped to the Bloom filter and the points mapped in the Bloom filter; Using all elements of the first hash sequence that are successfully mapped to the Bloom filter with a similarity greater than a similarity threshold as query elements, determine whether the number of query elements is greater than or equal to a number threshold; If yes, calculate the proportion of the query element among all elements in the first hash sequence, record it as the second proportion value, and proceed to the next step; otherwise, proceed to the next matching of the historical chess information. Calculate the sum of the first percentage value assigned a first weight and the second percentage value assigned a second weight, and record the sum as the chessboard existence coefficient; Determine whether the existence coefficient of the chess piece is greater than the existence threshold; If so, the current chess face information is matched with the current historical chess face information, and the historical chess game information of the matched current historical chess face information is recorded as having the historical chess game information of the current chess face information, and the process proceeds to the next matching of the historical chess face information; otherwise, the process proceeds to the next matching of the historical chess face information.

2. The method for locating a chess game using a robot according to claim 1, characterized in that, The method further includes: when it is determined that the current chess board information does not exist in at least one of the historical chess board information, determining a second move position that matches the current chess board information based on the current chess board information, and controlling the robot to make a move based on the second move position.

3. The method for locating a chess game using a robot according to claim 2, characterized in that, The steps for controlling the robot to place pieces according to their placement position include: The coordinates of the placement position on the current board are determined, which is the first coordinate information; A first transformation relationship is established between the chessboard coordinate system and the camera coordinate system. The first coordinate information is converted into second coordinate information through the first transformation relationship. The second coordinate information is the coordinate information of the placement position in the camera coordinate system. A second transformation relationship between the camera coordinate system and the robot coordinate system is established. The second coordinate information is converted into third coordinate information through the second transformation relationship. The third coordinate information is the coordinate information of the placement position in the robot coordinate system.

4. The method for locating a chess game using a robot according to claim 3, characterized in that, The steps of controlling the robot to place the piece according to the placement position also include: Based on the third coordinate information, a move instruction is generated and sent to the robot. The move instruction carries the third coordinate information so that the robot controls its robotic arm to place the piece at the move position according to the move instruction.

5. The method for locating a chess game using a robot according to claim 4, characterized in that, The placement position includes either the first placement position or the second placement position.

6. The method for locating a chess game using a robot according to claim 1, characterized in that, Before identifying the corresponding current chess board information through the current chess board image, the method further includes: performing image preprocessing on the current chess board image.

7. A system for locating a chess game using a robot, characterized in that, include: The acquisition unit is used to acquire the current chessboard image; The chessboard recognition unit is used to identify the corresponding current chessboard information through the current chessboard image; A game state judgment unit is used to acquire several historical game state information and determine whether the current game state information exists in at least one of the historical game state information. The position selection unit is used to filter out the historical game information that contains the current game information when the current game information exists in at least one of the historical game information, and obtain multiple candidate move positions corresponding to the current game information based on the filtered historical game information. The first position determination unit is used to determine a first position that matches the current chessboard information based on a plurality of candidate position selections. The first control unit is used to control the robot to place the piece according to the first placement position; The step of determining whether the current board information exists in at least one of the historical board information includes: For each historical board position in each historical game, a matching step is performed once to determine whether the historical board position matches the current board position. When the matching step has been completed for every historical chess face information of all historical chess game information, if the historical chess face information of at least one historical chess game information matches the current chess face information, then it is determined that the current chess face information exists in at least one historical chess game information. Specifically, for each historical board position in each historical game, the matching step includes: Obtain the coordinates of one or more chess pieces in the current chessboard information, calculate the hash value of each chess piece coordinate, and use the sequence of hash values ​​of each chess piece coordinate as the first hash sequence; Obtain the historical coordinates of one or more pieces from the current historical chess information, calculate the hash value of each historical coordinate of the piece, and use the sequence of hash values ​​of each historical coordinate of the piece as the second hash sequence; Determine whether at least one element in the first hash sequence has a first occurrence position in the second hash sequence; if so, then all elements in the first hash sequence that have a first occurrence position in the second hash sequence are taken as existing elements, calculate the proportion of the existing elements among all elements in the first hash sequence, record it as the first proportion value, and proceed to the next step; otherwise, proceed to the next matching of the historical chess information. Construct a Bloom filter based on the second hash sequence; Map each element of the first hash sequence to the Bloom filter; Calculate the similarity between the elements of the first hash sequence that are successfully mapped to the Bloom filter and the points mapped in the Bloom filter; Using all elements of the first hash sequence that are successfully mapped to the Bloom filter with a similarity greater than a similarity threshold as query elements, determine whether the number of query elements is greater than or equal to a number threshold; If yes, calculate the proportion of the query element among all elements in the first hash sequence, record it as the second proportion value, and proceed to the next step; otherwise, proceed to the next matching of the historical chess information. Calculate the sum of the first percentage value assigned a first weight and the second percentage value assigned a second weight, and record the sum as the chessboard existence coefficient; Determine whether the existence coefficient of the chess piece is greater than the existence threshold; If so, the current chess face information is matched with the current historical chess face information, and the historical chess game information of the matched current historical chess face information is recorded as having the historical chess game information of the current chess face information, and the process proceeds to the next matching of the historical chess face information; otherwise, the process proceeds to the next matching of the historical chess face information.

8. A system for locating a chess game using a robot according to claim 7, characterized in that, The system also includes: The second position determination unit is used to determine a second move position matching the current chess board information based on the current chess board information when it is determined that the current chess board information does not exist in at least one of the historical chess board information. The second control unit is used to control the robot to place the piece according to the second placement position.

9. A device for locating a chess game using a robot, characterized in that, include: At least one processor; At least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, a method for locating a chess game by a robot as described in any one of claims 1-6 is implemented.

10. A storage medium storing processor-executable instructions, characterized in that, The processor-executable instructions, when executed by the processor, are used to perform a method for locating a chess game by a robot as described in any one of claims 1-6.