Category Archives: Programming C++

Linux/Variants Programming


Linux/Variants Programming

Heuristic Search for the White Rook and King versus the Black King Chess Endgame Individual Project
The goal of the project to develop a software system that solves White Rook and King versus Black King Chess Endgame Problems (WRKBK for short). The steps of the project include: 0. Familiarize yourself with the WRKBK- problem and how to solve it “as a human”. 1. Implement the state space of the WRKBK- problem. 2. Select a search strategy and implement it! (use breadth first search, depth first search, A* search, or best first search) 3. Augment the search strategy with problem- specific knowledge! 4. Run the implemented system for the training benchmark. 5. Remove bugs from your implementation and enhance your search strategy and the problem specific knowledge it uses based on the experience of Step 4. 6. Repeat steps 4 and 5 until a satisfactory software system has been obtained. 7. Write a short report that summarizes your employed search strategy, the running of your program for the training benchmark, and gives a brief history of the project. 8. Be prepared to demo the software system you developed. It is assumed that white has to move first. Your objective is to capture the black king (stale mate has to be avoided). It is assumed that the fields on the chess board are represented as pairs of integers, where the first coordinate is assumed to be the x-coordinate, and the second coordinate is the y-coordinate: (1,1),(1,2),…,(8,8). Our version of the game is deterministic in the sence that black’s move is completely determined for a given position. The black king’s first priority is to capture an unprotected rook. If this is not possible, it is assumed that the black king moves to a safe field (a field is safe, if it is neither in the reach of the white rook nor in the reach of the white king) for which the following value is minimal:
|x-5|*5 + |y-5|*3 + (x+y)*0.1
If there is no such safe field the game ends. If the black king is attacked by the rook this is called a mate (which is a winning position for white); if the black king is not attacked but cannot move to a safe field this is called a stalemate (which is a draw and has to be avoided, when playing the white pieces). Test your system for the following WRKBK Training Benchmark (PROVIDED AT THE END OF THIS DOCUMENT), consisting of 13 test cases; the training testcases are ordered by degree of difficulty: do not get too disappointed, if your software system has some problems with some test cases with high numbers. Develop an interface to your program so that it can read a set of example problems from a file, and then solves all problems in the file, and generates an output file containing solutions (and background info about the obtained solutions) for the problem set of the input file. In general, Project1 input-files of the following format:
number of games to play(integer) newline name of the test case(4 asci character) newline starting position (8 lines — see example) empty_line newline name of starting position(4 asci character) newline starting position (8 lines — see example) empty_line …
Moreover, add a counter to your program that counts the number of chessboard positions that are generated by your program during the search process; moreover, terminate the search after more than 10000 board positions have been generated for a single example problem. If your program succeeded in capturing the king, output the sucessful state sequence (only displaying the positions with white on move) and report the number of white moves it took to capture the king, and how many board positions had to be generated in order to find the solution; output NA if your program could not find a solution for the particular testcase. Design your program that your program has an option that your program output can be visualized on the screen, in addition to write the output to an output file. Moreover, WRKBK software system will be additionally tested using a testing benchmark of 7 testcases that will not be published before the Project1 deadline. WRKBK Training Benchmark :
13 TR01 BK — — — — — — — — — — — — — — WR — — — — WK — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — — — — — — — — — — — — — — —
TR02 — — — — — — BK — — — — — — — — WR — WK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR03 — — — — — BK — — — — — — — — — WR — — — — WK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR04 BK — — — — — — — — — — — — — — — — — — — WK — — — — WR — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR05 — — — — — — — — — — — — — — — WR — — — — WK — BK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR06 — — — — — — — — — — BK — — — — — — — — WR — — — — — — — — WK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR07 — — — — — — — — — — — — — BK — — — — — WR — — — — — — — — WK — — — — — — — — — — —
— — — — — — — — — — — — — — — — — — — — — — — —
TR08 — — — — — — — — — — BK — — — — — — — — WR — — — — — — WK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR09 — — — — — — — — — — — — — — — — — — BK — — — — — — — — — — — — — — — WK — WR — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR10 BK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — WK — — — — — — — — — — — — — — — — — — — — — — WR — — — — —
TR11 — — — — — — — — — — — — — — — — — — BK — — — — — — — — — — — — — — — WK — — — — — — — WR — — — — — — — — — — — — — — — — — — — — —
TR12 WR WK — BK — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
TR13 — — — WR — — — — — — — — — — — — — — — WK — — — — — — — — — — — — — — — — — — — — — — BK — — — — — — — — — — — — — — — — — — — — —

 

Move Generators and Other Basic Functions for the WRKBK Problem
 Develop a function WMOVE: State2
Move
; e.g WMOVE(s34) returns the moves white can make in state s23, e.g. ((K, 3, 4), (R, 8, 5)). Remark: Do not creates moves that lead to the death of the white king or the loss of the white rook!  Develop a function BMOVE: StateState{c, s, m} that takes the input state and returns the state obtained by moving the black king; the function additionally returns the status of the game: c indicates that the game continues, s indicates that we have a stale mate, m indicates that we have a mate; in the case that the input state s is a mate or stalemate position, BMOVE(s) returns (s,’s’) or (s,’m’).  Using the first 2 functions, develop a function APPLYM: State  Move  State {c, s, m} that applies the (white) input move to the input state obtaining a new state s’ and moves the black king in state s’, and returns the state obtained; that is it applies two moves and returns the obtained state and the status of the game: either ‘c’, ‘s’ or ‘m’.   Write a function that reads training and test files.  Write a main program that executes your software system by running your search function for the problems in the input files, and which writes solutions and meta data for each solution to an output file.   Write a function to visualize WRKBK states and solutions to the WRKBK problems  Write a function to visualize solutions to WRKBK problems  Represent states efficiently as you will create a lot of them e.g. just use 6 numbers that represent the positions of the 3 pieces or even only a single number e.g. 446668!
Other Advice  Get software that reads the file and solves the problem in the file and produces an output file for all testcases first.   Make the number of state explored SEXPL a constant, and set it to a small value; e.g. 50 first and not 10000; as you might recall in case that you generated exceeds SEXP, you program should terminate unsuccessfully.  Using other Software in the Project: – Use of chess playing programs is strictly prohibited, but use of general software for search or modification of pseudo code of such software is allowed. – However if you use search or other software in your software system, you have to mention/reference this software in your final report; failing to do so is an academic honesty violation. This should be done for every external software you use; e.g. if you use chess board display software is fine, but you have to acknowledge that you used this software and did not write it yourself.  Thoughts on Search Strategies for the WRKBK Problem  The task is to solve the problem at hand  Hill-Climbing, Randomized Hill Climbing, Backtracking, Best-first Search,… all seem to be suitable search strategies for the problem  Find “good” evaluation functions” (e.g. f(pos)=king_close_w_king(pos)* + king_close_to_rook(pos)* + *1/Freedom_black_king(pos)) for one of the available search strategies  Rapid prototyping is strongly recommended; also don’t make things too complicated at the beginning  Try to learn from sample runs  Idea: break the problem into sub-problems and solve each sub-problem separately.
 Idea: Reduce the search space by disallowing certain moves  Idea: Use look-ahead when you use backtracking or hill climbing  You are allowed to take advantage of the face that “you know in advance how the black king moves”. It is okay if you implement a game-style system but you should be aware of the fact that you are trying to solve a more complicated problem which makes it much harder to get your system running.  “Complex” search strategies are frequently hard to debug/improve.
 Instead of looking to all possible positions sample some of those to reduce the complexity of the search  Checking for duplicate states might or might not help (this answer is dependent on the employed search strategy)  Disjunctive goals in search create problems  Taking advantage of symmetry is complicated, but might help!  There is a training benching that is already posted, consisting of 13 problems and a test benchmark consisting of 7 problems will be used to evaluate how your software systems deals with “novel” problems. Test cases will be sorted by difficulty; if you program cannot solve all the test problems this is not the end of the world; however, if it is not able to solve the “simple” cases you will not get a good grade for project.  The primary goal is to checkmate the black king; however, programs that find shorter solutions will get higher, but not necessarily a lot higher scores.   The project will be graded evaluating your report, the quality of the designed program, and the programs performance for the training and test set. Program performance for training and testing  benchmark will count at least 55% towards the overall grade.

Programming project in c++s


Programming project in c++s for advance os

Programming project in c++s for advance os

  • Can you give me a c++ code in Linux environment and there must be no bugs and you must demonstrate the code is it possible with you and till when you can give me the code
  • When can you give complete code which works without any bugs?
  • Could you give me the first release by 3pm?
  • Ok I will give it to you but i want the perfect code at the end.

Description

  • It must be complete the entire requirement and the code in c++ programming language
  • 3 pages (825 words)
  • FormatMLA
  • DisciplineComputer Science
%d bloggers like this: