Python Forum
How to solve pancake flip with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to solve pancake flip with Python
#3
(May-09-2022, 03:56 PM)deanhystad Wrote: You have an error computing the heuristic value.
Yes, I am aware. I am doing this instead but it is not the solution.
  if self.pancake_stack[3][1] == 'b' or self.pancake_stack[3][0] == 4:
            self.heuristic = 0
        elif self.pancake_stack[3][1] != 'w' or self.pancake_stack[3][0] != 4:
            self.heuristic = 4
        elif (self.pancake_stack[2][1] != 'w') or (self.pancake_stack[2][0] != 3):
            self.heuristic = 3
        elif (self.pancake_stack[1][1] != 'w') or (self.pancake_stack[1][0] != 2):
            self.heuristic = 2
        elif (self.pancake_stack[0][1] != 'w') or (self.pancake_stack[0][0] != 1):
            self.heuristic = 1
Because when I am using this input 1b2b3w4b-a all the h values are 0
1b|2b3w4b g:0, h:0
1w2b3w4b| g:1, h:0
4w|3b2w1b g:5, h:0
4b3b2w1b| g:6, h:0
1w2b|3w4w g:10, h:0
2w|1b3w4w g:12, h:0
2b1b|3w4w g:13, h:0
1w2w3w4w g:15, h:0
Actually I am expected this output
1b2b|3w4b g:0, h:0
2w|1w3w4b g:2, h:2
2b1w3w4b| g:3, h:2
4w|3b1b2w g:7, h:4
4b3b1b2w| g:8, h:4
2b1w|3w4w g:12, h:2
1b|2w3w4w g:14, h:0
1w2w3w4w g:15, h:0
Reply


Messages In This Thread
How to solve pancake flip with Python - by longmen - May-09-2022, 03:23 PM
RE: How to solve pancake flip with Python - by longmen - May-09-2022, 04:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to solve this problem Python configuration? magomes 5 1,048 Mar-22-2024, 11:11 PM
Last Post: magomes
  Two Python problems to solve djzsp 1 652 Mar-17-2024, 01:18 AM
Last Post: deanhystad
Star Interesting Intro to python problem I can't solve. Honestworker 5 12,755 Mar-04-2021, 02:05 AM
Last Post: BashBedlam
  solve probability problem by python Dreammer 1 2,002 Dec-24-2020, 09:51 AM
Last Post: Larz60+
  Cross word puzzle solve using python constraint library aliyark145 1 3,443 Nov-29-2018, 10:53 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020