Title: find_path() giving me complex output rather than list of tuples · Issue #56 · brean/python-pathfinding · GitHub
Open Graph Title: find_path() giving me complex output rather than list of tuples · Issue #56 · brean/python-pathfinding
X Title: find_path() giving me complex output rather than list of tuples · Issue #56 · brean/python-pathfinding
Description: Hello, I am trying to use pathfinding but the output I get for the path from the find_path() method is not what I would expect. I would expect a simple list of tuples but instead it is fulled with
Open Graph Description: Hello, I am trying to use pathfinding but the output I get for the path from the find_path() method is not what I would expect. I would expect a simple list of tuples but instead it is fulled with ...
X Description: Hello, I am trying to use pathfinding but the output I get for the path from the find_path() method is not what I would expect. I would expect a simple list of tuples but instead it is fulled with ...
Opengraph URL: https://github.com/brean/python-pathfinding/issues/56
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"find_path() giving me complex output rather than list of tuples","articleBody":"Hello, I am trying to use pathfinding but the output I get for the path from the `find_path()` method is not what I would expect. I would expect a simple list of tuples but instead it is fulled with `\u003cGridNode(0:0 0x104760110)\u003e` and I am not sure what is wrong with my setup. \r\n\r\nMy system is: MacOS Sonoma 14.2.1 (M1 Pro chip) and I am running Python 3.12.1 and pathfinding 1.0.9. \r\n\r\nThe code that I am using as a test is below: \r\n\r\n```\r\nfrom pathfinding.core.diagonal_movement import DiagonalMovement\r\nfrom pathfinding.core.grid import Grid\r\nfrom pathfinding.finder.a_star import AStarFinder\r\nimport random\r\n\r\nblockpositions = []\r\n\r\ndef makegrid(x2, y2):\r\n\tgrid = []\r\n\tfor x in range(x2):\r\n\t\tgrid.append([])\r\n\t\tfor y in range(y2):\r\n\t\t\tif random.randint(1,5)==1:\r\n\t\t\t\tblockpositions.append((x, y))\r\n\t\t\t\tgrid[x].append(0)\r\n\t\t\telse:\r\n\t\t\t\tgrid[x].append(1)\r\n\treturn grid\r\n\r\ngrid = makegrid(50, 50)\r\nstartpos = (0, 0)\r\nendpos = (49, 49)\r\n\r\nfinder = AStarFinder(diagonal_movement=DiagonalMovement.always)\r\ngrid2 = Grid(matrix = grid)\r\n\r\nstart = grid2.node(startpos[0], startpos[1])\r\nend = grid2.node(endpos[0], endpos[1])\r\n\r\npath, runs = finder.find_path(start, end, grid2)\r\nfor x in path:\r\n\tif x in blockpositions:\r\n\t\tprint(\"block in path!\")\r\nprint(path)\r\n```\r\n\r\nThe output is:\r\n`[\u003cGridNode(0:0 0x104760110)\u003e, \u003cGridNode(1:1 0x104b46c90)\u003e, \u003cGridNode(2:1 0x104b46cc0)\u003e, \u003cGridNode(3:2 0x104b47650)\u003e, \u003cGridNode(3:3 0x104b47fb0)\u003e, \u003cGridNode(4:4 0x104b74980)\u003e, \u003cGridNode(5:5 0x104b75310)\u003e, \u003cGridNode(6:6 0x104b75ca0)\u003e, \u003cGridNode(7:7 0x104b76630)\u003e, \u003cGridNode(8:8 0x104b76fc0)\u003e, \u003cGridNode(9:9 0x104b77950)\u003e, \u003cGridNode(10:10 0x104b84320)\u003e, \u003cGridNode(11:10 0x104b84350)\u003e, \u003cGridNode(12:11 0x104b84ce0)\u003e, \u003cGridNode(13:12 0x104b85670)\u003e, \u003cGridNode(14:13 0x104b86000)\u003e, \u003cGridNode(15:14 0x104b86990)\u003e, \u003cGridNode(16:15 0x104b87320)\u003e, \u003cGridNode(17:16 0x104b87cb0)\u003e, \u003cGridNode(18:17 0x104b98680)\u003e, \u003cGridNode(19:18 0x104b99010)\u003e, \u003cGridNode(20:19 0x104b999a0)\u003e, \u003cGridNode(21:20 0x104b9a330)\u003e, \u003cGridNode(22:21 0x104b9acc0)\u003e, \u003cGridNode(23:22 0x104b9b650)\u003e, \u003cGridNode(24:23 0x104b9bfe0)\u003e, \u003cGridNode(25:24 0x104ba89b0)\u003e, \u003cGridNode(26:25 0x104ba9340)\u003e, \u003cGridNode(26:26 0x104ba9ca0)\u003e, \u003cGridNode(27:27 0x104baa630)\u003e, \u003cGridNode(28:28 0x104baafc0)\u003e, \u003cGridNode(29:29 0x104bab950)\u003e, \u003cGridNode(30:30 0x104bb8320)\u003e, \u003cGridNode(30:31 0x104bb8c80)\u003e, \u003cGridNode(31:32 0x104bb9610)\u003e, \u003cGridNode(32:33 0x104bb9fa0)\u003e, \u003cGridNode(33:34 0x104bba930)\u003e, \u003cGridNode(34:34 0x104bba960)\u003e, \u003cGridNode(35:35 0x104bbb2f0)\u003e, \u003cGridNode(36:36 0x104bbbc80)\u003e, \u003cGridNode(37:37 0x104bc8650)\u003e, \u003cGridNode(38:37 0x104bc8680)\u003e, \u003cGridNode(39:38 0x104bc9010)\u003e, \u003cGridNode(40:39 0x104bc99a0)\u003e, \u003cGridNode(41:40 0x104bca330)\u003e, \u003cGridNode(42:41 0x104bcacc0)\u003e, \u003cGridNode(43:41 0x104bcacf0)\u003e, \u003cGridNode(44:42 0x104bcb680)\u003e, \u003cGridNode(45:43 0x104bd8050)\u003e, \u003cGridNode(46:44 0x104bd89e0)\u003e, \u003cGridNode(47:45 0x104bd9370)\u003e, \u003cGridNode(48:46 0x104bd9d00)\u003e, \u003cGridNode(49:47 0x104bda690)\u003e, \u003cGridNode(49:48 0x104bdaff0)\u003e, \u003cGridNode(49:49 0x104bdb950)\u003e]`\r\n\r\nPlease let me figure out what is going wrong. ","author":{"url":"https://github.com/jamespblloyd-uwa","@type":"Person","name":"jamespblloyd-uwa"},"datePublished":"2024-01-20T13:57:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/56/python-pathfinding/issues/56"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:95116381-e502-44f1-5ac9-af9569c28595 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C39C:282B52:39600:48129:698D2441 |
| html-safe-nonce | 7cb59c1a5fe163499468a531d1aed2bfef8c34884c68dd4b65582e40b34af26b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzlDOjI4MkI1MjozOTYwMDo0ODEyOTo2OThEMjQ0MSIsInZpc2l0b3JfaWQiOiIzOTc5NjYxNjEwOTkzOTE5MDQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d0f629904c31a8d74b1f199cbb5fbfb44ba7500663bf59a249bac2cf7b780a5b |
| hovercard-subject-tag | issue:2092063005 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/brean/python-pathfinding/56/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5efe275133dc5d2f73b9cefe44716a0b15c1551017c276b3fca380d93fd6fea5/brean/python-pathfinding/issues/56 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5efe275133dc5d2f73b9cefe44716a0b15c1551017c276b3fca380d93fd6fea5/brean/python-pathfinding/issues/56 |
| og:image:alt | Hello, I am trying to use pathfinding but the output I get for the path from the find_path() method is not what I would expect. I would expect a simple list of tuples but instead it is fulled with ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jamespblloyd-uwa |
| hostname | github.com |
| expected-hostname | github.com |
| None | c25395580e1e3bf82d705e0982a1b24255366088720fef945f1493d5e3e67954 |
| turbo-cache-control | no-preview |
| go-import | github.com/brean/python-pathfinding git https://github.com/brean/python-pathfinding.git |
| octolytics-dimension-user_id | 229768 |
| octolytics-dimension-user_login | brean |
| octolytics-dimension-repository_id | 32716626 |
| octolytics-dimension-repository_nwo | brean/python-pathfinding |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 32716626 |
| octolytics-dimension-repository_network_root_nwo | brean/python-pathfinding |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fa2bc33fc715bfb2cb9dd8a9cad4f811c16c371 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width