Exhaustive Search of Piece Combinations Based on Total Shannon Value
Total Page:16
File Type:pdf, Size:1020Kb
electronic Journal of Computer Science and Information Technology (eJCSIT), Vol. 5, No. 1, 2015 Exhaustive Search of Piece Combinations Based on Total Shannon Value Shazril bin Azman1 Azlan Iqbal2 1, 2College of Information Technology, Universiti Tenaga Nasional, Putrajaya Campus, Jalan IKRAM-UNITEN, 43000 Kajang, Selangor e-mail: [email protected], [email protected] Abstract— In chess games, the Shannon value is one way to In this paper, we demonstrate a method to produce all the represent the relative values of chess pieces. We propose a piece combinations based on a particular TSV specified. The method to perform an exhaustive search of piece combinations piece combination consist of different possible combinations based on any given total Shannon value. Nested loops are used of queens, rooks, knights, bishops and pawns that are equal to along with certain sentinel controls that comply with the basic any given TSV and they are technically ‘legal’ in the game. rules of chess. For example, there are 9 loops assigned for the In Section II, we review some related works ranging from queen, as the maximum legal number of queens on the board is 9, including the promoted pawns. Therefore, each chess piece the historical background of the concept of permutation and (queen, rook, bishop, knight, pawn) has its own specific number its utilization in modern day applications. Section III of loops which correspond to its legal number and they are describes the method towards generating the piece nested in together. The experiment performed shows that if combination, and Section IV shows the results obtained. We nested loops that represent each of the pieces are arranged conclude briefly with Section V. together along with the chess-based sentinel controls, they can produce all possible and legal chess piece combinations that II. LITERATURE REVIEW match the desired Total Shannon Value (TSV). This method can be used for a variety of purposes in chess engines and other A. Permutation games or areas with similar constructs and constraints. The concept of permutations was first reported in ancient Index terms— Shannon value, nested loops, piece India [3]. Old Indian scriptures, such as the Brihat Samhita combination, exhaustive search deals with the treatise of permutations such as making perfume by mixing various ingredients in various I. INTRODUCTION combinative ways. In the writings of Brahmagupta, there are The Shannon value is a representation of the relative passages that deal with inquisitive permutations to be made, values of the chess pieces. It originates from C. Shannon’s such as how many different ways that 8 doors could be approximate evaluation function for programming a opened if the number of apertures in all the doors are one, computer to play chess [1]. Shannon’s evaluation function two, three, four and so on. However, further details or can be used by the computer in a chess game to decide which depictions are not available in the ancient texts. probably the best move is in order to win. Any chess player, Permutation allows different combinations of a set of be it human or computer, would typically strive to maintain symbols, numbers or alphabets, for instance, to be made. For the Total Shannon Value (TSV) or reduce the other player’s example, given the numbers 1, 2, and 3, the total permutation TSV, which is basically material in the game. Each of the five number is six, in total and as shown in Fig. 1. different chess pieces has the following Shannon values: 1, 2, 3 • Queen = 9 1, 3, 2 • Rook = 5 2, 1, 3 • Bishop = 3 2, 3, 1 • Knight = 3 3, 1, 2 • Pawn = 1 3, 2, 1 The king is usually excluded in the TSV because it is Figure 1. Permutations of 1, 2 and 3. regarded as having ‘infinite’ importance in a chess game. Losing the king means losing the game. The values assigned The above example can also be calculated as 3! (3 to each chess piece typically depend on the inherent utility of factorial) or 3x2x1=6, meaning that it has six different ways a particular piece. C. James in his ‘relative strength’ approach of permuting the numbers. Permutations also have been in [2] added more refinements by assigning values to a chess widely used to protect multimedia data across the internet [4]. piece based on its ‘mobility aspect’ such as counting the Digital multimedia elements such as pixels and video signals number of squares controlled by the chess piece so that the can be permuted in a secure way to cipher the multimedia value of the piece is more reliable. For example, the relative data before it is sent to the authorized recipient. For example, strength value for the king at the corner of the board is 3, the word ‘drinking water’ could be encoded into ‘rgnkadnei because at that position, the king controls three squares in his wit’ by using a certain permutation matrix and can be safely surroundings. The queen would have more relative strength decoded by the authorized receiver who has a prior value than the other pieces because the queen has more decryption key. Digital multimedia files such as JPEG could controlled squares. S. Azman and A. Iqbal, Exhaustive Search of Piece Combinations Based on Total Shannon Value 7 electronic Journal of Computer Science and Information Technology (eJCSIT), Vol. 5, No. 1, 2015 also be encoded into blurry and randomized pixels that an Hackers are more likely to be individuals who try to gain unauthorized recipient would not understand. unauthorized access on documents, software, or computer. Permutations are also useful to reduce storage Crackers, on the other hand, are the individuals who try to requirements and disk transfer rates in video-on-demand find security loopholes to bypass certain firewalls via the (VOD) systems. In video broadcasting, the management of network [10]. video block storage in the set-top box (see Fig. 2) is An example of a computer program that utilizes brute important. A set-top box is another name for the video force is Chinook. Chinook is a checker program that uses a decoder [5]. In Malaysia, for example, the video decoder deep brute force search algorithm with its own evaluation device provided by AstroTM to the users is a set-top box per se function to play against human player. Chinook was played [6]. against human player in an actual checker tournament in 1992 (World Checkers Champion) but lost at the hands of Dr. Marion Tinsley, the defending champion. J. Schaeffer pointed out that there comes a point where deep brute force search is not cost effective. Certain factors such as high processing and hardware consumption should also be considered in brute force approach [11, 12]. Otherwise known as diminishing returns. C. Shannon also argued that game strategies should not rely too much on brute force. Instead, logical analyses of the piece’s position should be focused upon. Brute force is also used in password recovery tools that permute all possible combinations of digits, alphabets and Figure 2. Astro Video Decoder. symbols to recover the forgotten password. However, since the recovery task is arduous, and could take millions of years, While buffering, part of the video block is initially stored the tools provide settings to narrow down the exhaustive in the device before being displayed, just like a YoutubeTM search, such as recovering a password that might contain a video’s buffering grey bar at the bottom of the flash video possible word or character that the user can remember, or is player that is progressively increasing throughout the contained in a dictionary [13]. playback, indicating that the video block is stored in the computer progressively [7]. C. Recursion A method called recursion was studied. Recursion can be roughly translated as ‘call back’ [14]. It enables the computer to call back a previous instruction or code line. For example, the computer is reading code line number four, and then at the next code line, it is instructed to go back to code line number two, so the computer goes back to read code line number two. This can be done repetitively until it fulfills certain conditions. Recursion in programming can perhaps better be described as a function that calls itself in order to solve a simpler version of the problem before ‘scaling up’ to the final answer. Figure 3. YoutubeTM buffering bar, as shown by the red arrow. D. Programming Language Used We used the Python Programming Language to generate High bandwidth video transmission will give smooth the piece combinations. Python was developed by Guido von streaming, but it increases the storage requirement and this Rossum in 1990 [15]. It is known for its short, clear and easy could cause latency in the transmission traffic. If there are syntax, high level dynamic data types and portability. Its thousands of users being given high bandwidth video outputs can be easily copied and pasted into a spreadsheet transmission simultaneously, it would bottleneck the program such as Microsoft Excel for further analysis. transmission traffic. This will cause latency. Charu et al. in [8] introduced a permutation-based pyramid broadcasting scheme, which transmits video blocks in a pre-specified III. METHODOLOGY cyclic permutation and it substantially reduces the latency, We coin the term ‘piece combination’ as a reference to the storage and disk transfer rate. combination of chess pieces that matches the desired TSV when each of their Shannon values is summed up together. B. Brute Force The piece combination concept is inspired by the concepts of permutation, brute force and recursion, even though it does The other common name for exhaustive search is ‘brute not follow those concepts exactly.