Page 1 of 1

I 1.2 PART 2:Coding Hill Climbing Create a python program called queens_hc.py that takes in one parameter from the comma

Posted: Sun Jul 03, 2022 11:22 am
by answerhappygod
I 1 2 Part 2 Coding Hill Climbing Create A Python Program Called Queens Hc Py That Takes In One Parameter From The Comma 1
I 1 2 Part 2 Coding Hill Climbing Create A Python Program Called Queens Hc Py That Takes In One Parameter From The Comma 1 (230.61 KiB) Viewed 21 times
In python
MUST RUN FROM COMMAND LINE!!!
DO NOT COPY AND PASTE OTHER answers ANSWERS THEY'RE INCORRECT
**********************USE THIS CODE SKELETON********************
I 1.2 PART 2:Coding Hill Climbing Create a python program called queens_hc.py that takes in one parameter from the command line: an integer. This integer will indicate the number of puzzles it will have to solve. Run it like so (for example, to solve 5 random puzzles): queens_hc.py 5. Follow the directions/advice below: 1. The program should generate as many 8-queens initial states (boards) as the num- ber from the command line indicates. Each state should be represented by a list with 8 elements. Each element indicates the position of a queen in a column. For example: [8, 2, 5, 1, 3, 4, 7, 6] represents the following board: 8 M 7 6 5 4 3 2 會 1 2 3 4 5 會 6 7 8 2. queens.py, should have the following functions named exactly as follows: heuristic (board) that takes a board (state) as described above and returns the number of attacking queens (directly and indirectly). • find_best_successor (board) that will explore all possible suc- cessors of a board by altering the position of each queen, one space at a time along its colum. best_successor should explore 56 boards and return two values: The best board and its heuristic. find_solution_HC (board) implements hill climbing. Returns the final board, the number of iterations, and the heuristic of the board in a list. Use the skeleton here http://fid.cl/courses/ai/hw/queens_hc. py to get you started. Also, if this program prints "True" under the "Tests" section, you are likely on the right track. (AKA. you will get a C or better for sure).