Python Forum
How to fix list index out of range
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fix list index out of range
#12
As far as this:
Quote:Can you elaborate on insert() to set move or values?
What do you think list.insert(value) does? It is not the correct way to SET values in a list.

I would like you to describe your Q learning algorithm. I cannot tell if it contains errors in logic or execution or my not understanding your requirements without knowing what you think it is supposed to do. For example, you always start at the same square but it appears that you want a solution for the entire map. I can design a map where that is not possible. It also seems a very inefficient way to generate a map, and even with 10000 iterations there remains a possibility that you do not try all routes. You calculate a total episode reward that is never used. You pass arguments to Q_learning() that are not used.

I think I implemented your algorithm and I get this result for inputs: 15 12 8 6 p
Output:
13 → 14 → 15 G 16 ← 9 ↑ 10 ↑ 11 ↑ 12 G 5 ↑ 6 W 7 ↑ 8 F 1 ↑ 2 → 3 ↑ 4 ←
I think this is correct. 16 cannot be up as you indicate in your expected results. 16 does not have an "Up" neighbor.
Reply


Messages In This Thread
How to fix list index out of range - by longmen - Apr-13-2022, 02:28 AM
RE: How to fix list index out of range - by longmen - Apr-15-2022, 03:54 AM
RE: How to fix list index out of range - by longmen - Apr-18-2022, 03:12 PM
RE: How to fix list index out of range - by longmen - Apr-20-2022, 01:54 AM
RE: How to fix list index out of range - by longmen - Apr-23-2022, 07:02 PM
RE: How to fix list index out of range - by longmen - Apr-24-2022, 02:25 AM
RE: How to fix list index out of range - by deanhystad - Apr-24-2022, 02:59 AM
RE: How to fix list index out of range - by longmen - Apr-24-2022, 02:51 PM
RE: How to fix list index out of range - by longmen - Apr-24-2022, 03:42 PM
RE: How to fix list index out of range - by longmen - Apr-24-2022, 05:22 PM
RE: How to fix list index out of range - by longmen - Apr-24-2022, 10:45 PM
RE: How to fix list index out of range - by longmen - Apr-25-2022, 12:20 AM
RE: How to fix list index out of range - by longmen - Apr-25-2022, 02:22 AM
RE: How to fix list index out of range - by longmen - Apr-25-2022, 05:44 PM
RE: How to fix list index out of range - by longmen - Apr-27-2022, 05:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  list index out of range OliverG 3 2,478 Sep-03-2021, 12:04 AM
Last Post: itsmycode
  Index List a04j 2 3,065 Jul-10-2021, 01:14 PM
Last Post: BashBedlam
  List index out of range when turning CSV into dict ranbarr 15 6,950 May-12-2021, 10:38 AM
Last Post: ranbarr
  List vs index: Frederico_Caldas 5 3,825 Jul-03-2020, 10:55 AM
Last Post: DeaD_EyE
  To find the index of the first occurrence of the key in the provided list Angry_bird89 4 3,521 Jun-20-2020, 06:53 PM
Last Post: Angry_bird89
  list index out of range mcgrim 2 3,028 May-25-2019, 07:44 PM
Last Post: mcgrim
  IndexError: list index out of range abdullahali 4 4,028 Jan-17-2019, 07:54 AM
Last Post: buran
  String index out of range felie04 2 5,673 Aug-17-2018, 11:18 PM
Last Post: felie04
  Accessing data in zip - Index out of range pythoneer 24 13,514 Mar-15-2018, 06:19 PM
Last Post: buran
  "List index out of range" for output values pegn305 3 5,459 Nov-26-2017, 02:20 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

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