|
691 | 691 | "\n", |
692 | 692 | "```\n", |
693 | 693 | "⬜ ⬜ 🔴 ⬜ ⬜\n", |
| 694 | + "⬜ ⬜ ⬜ ⬜ ⬜\n", |
694 | 695 | "⬜ ⬜ ⬜ ⬜ ⬜ Ball\n", |
| 696 | + "⬜ ⬜ ⬜ ⬜ ⬜\n", |
695 | 697 | "⬜ ⬜ ⬜ ⬜ ⬜ falls\n", |
| 698 | + "⬜ ⬜ ⬜ ⬜ ⬜\n", |
696 | 699 | "⬜ ⬜ ⬜ ⬜ ⬜ down\n", |
| 700 | + "⬜ ⬜ ⬜ ⬜ ⬜\n", |
| 701 | + "⬜ ⬜ ⬜ ⬜ ⬜\n", |
697 | 702 | "⬜ ⬜ 🏓 ⬜ ⬜\n", |
698 | 703 | " Paddle\n", |
699 | 704 | "```\n", |
|
702 | 707 | "<td width=\"60%\">\n", |
703 | 708 | "\n", |
704 | 709 | "**Rules:**\n", |
705 | | - "- 5×5 grid\n", |
| 710 | + "- 10×5 grid\n", |
706 | 711 | "- Ball falls from random column\n", |
707 | 712 | "- Move paddle left/right to catch it\n", |
708 | 713 | "\n", |
|
1007 | 1012 | "\n", |
1008 | 1013 | " def select_action(self, obs: OpenSpielObservation) -> int:\n", |
1009 | 1014 | " # Parse OpenSpiel observation\n", |
1010 | | - " # For Catch: info_state is a flattened 5x5 grid\n", |
| 1015 | + " # For Catch: info_state is a flattened 10x5 grid\n", |
1011 | 1016 | " # Ball position and paddle position encoded in the vector\n", |
1012 | 1017 | " info_state = obs.info_state\n", |
1013 | 1018 | "\n", |
1014 | 1019 | " # Find ball and paddle positions from info_state\n", |
1015 | | - " # Catch uses a 5x5 grid, so 25 values\n", |
| 1020 | + " # Catch uses a 10x5 grid, so 50 values\n", |
1016 | 1021 | " grid_size = 5\n", |
1017 | 1022 | "\n", |
1018 | | - " # Find positions (ball = 1.0, paddle = 0.5 in the flattened grid)\n", |
| 1023 | + " # Find positions (ball = 1.0 in the flattened grid, paddle = 1.0 in the last row of the flattened grid)\n", |
1019 | 1024 | " ball_col = None\n", |
1020 | 1025 | " paddle_col = None\n", |
1021 | 1026 | "\n", |
|
1025 | 1030 | " break\n", |
1026 | 1031 | "\n", |
1027 | 1032 | " last_row = info_state[-grid_size:]\n", |
1028 | | - " paddle_col = last_row.index(1.0)\n", |
| 1033 | + " paddle_col = last_row.index(1.0) # Paddle\n", |
1029 | 1034 | "\n", |
1030 | 1035 | " if ball_col is not None and paddle_col is not None:\n", |
1031 | 1036 | " if paddle_col < ball_col:\n", |
|
0 commit comments