ed-donner commited on
Commit
da4100f
·
1 Parent(s): d2c1e33

Minor tweaks after making video

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. prototype.ipynb +14 -4
README.md CHANGED
@@ -23,6 +23,7 @@ It has been great fun making this Arena and watching LLMs duke it out!
23
  Quick links:
24
  - The [Live Arena](https://edwarddonner.com/connect-four/) courtesy of amazing HuggingFace Spaces
25
  - The [GitHub repo](https://github.com/ed-donner/connect) for the code
 
26
  - My [LinkedIn](https://www.linkedin.com/in/eddonner/) - I love connecting!
27
 
28
  If you'd like to learn more about this:
 
23
  Quick links:
24
  - The [Live Arena](https://edwarddonner.com/connect-four/) courtesy of amazing HuggingFace Spaces
25
  - The [GitHub repo](https://github.com/ed-donner/connect) for the code
26
+ - My [video walkthrough](https://youtu.be/0OF-ChlKOQY) of the code
27
  - My [LinkedIn](https://www.linkedin.com/in/eddonner/) - I love connecting!
28
 
29
  If you'd like to learn more about this:
prototype.ipynb CHANGED
@@ -67,7 +67,7 @@
67
  "class Board:\n",
68
  "\n",
69
  " def __init__(self):\n",
70
- " self.cells = [[0 for _ in range(7)] for _ in range(6)]\n",
71
  " self.player = RED\n",
72
  " self.winner = EMPTY\n",
73
  "\n",
@@ -245,7 +245,7 @@
245
  " def system(self, board):\n",
246
  " legal_moves = \", \".join(board.legal_moves())\n",
247
  " return f\"\"\"You are an expert player of the board game Connect 4.\n",
248
- "Players take turns to drop counters into one of 6 columns labelled A, B, C, D, E, F.\n",
249
  "The winner is the first player to get 4 coins in a row in a straight or diagonal line.\n",
250
  "You are playing with the {pieces[self.color]} coins.\n",
251
  "And your opponent is playing with the {pieces[self.color * -1]} coins.\n",
@@ -305,7 +305,9 @@
305
  " messages=[\n",
306
  " {\"role\": \"system\", \"content\": system},\n",
307
  " {\"role\": \"user\", \"content\": user}\n",
308
- " ]\n",
 
 
309
  " )\n",
310
  " self.process_move(reply.choices[0].message.content)"
311
  ]
@@ -329,7 +331,7 @@
329
  "source": [
330
  "board = Board()\n",
331
  "red = Player(\"gpt-4o-mini\", RED)\n",
332
- "yellow = Player(\"gpt-4o-mini\", YELLOW)\n",
333
  "while not board.winner:\n",
334
  " red.move(board)\n",
335
  " print(board)\n",
@@ -337,6 +339,14 @@
337
  " yellow.move(board)\n",
338
  " print(board)"
339
  ]
 
 
 
 
 
 
 
 
340
  }
341
  ],
342
  "metadata": {
 
67
  "class Board:\n",
68
  "\n",
69
  " def __init__(self):\n",
70
+ " self.cells = [[EMPTY for _ in range(7)] for _ in range(6)]\n",
71
  " self.player = RED\n",
72
  " self.winner = EMPTY\n",
73
  "\n",
 
245
  " def system(self, board):\n",
246
  " legal_moves = \", \".join(board.legal_moves())\n",
247
  " return f\"\"\"You are an expert player of the board game Connect 4.\n",
248
+ "Players take turns to drop counters into one of 7 columns labelled A, B, C, D, E, F, G.\n",
249
  "The winner is the first player to get 4 coins in a row in a straight or diagonal line.\n",
250
  "You are playing with the {pieces[self.color]} coins.\n",
251
  "And your opponent is playing with the {pieces[self.color * -1]} coins.\n",
 
305
  " messages=[\n",
306
  " {\"role\": \"system\", \"content\": system},\n",
307
  " {\"role\": \"user\", \"content\": user}\n",
308
+ " ],\n",
309
+ " response_format={\"type\": \"json_object\"}\n",
310
+ " \n",
311
  " )\n",
312
  " self.process_move(reply.choices[0].message.content)"
313
  ]
 
331
  "source": [
332
  "board = Board()\n",
333
  "red = Player(\"gpt-4o-mini\", RED)\n",
334
+ "yellow = Player(\"gpt-4o\", YELLOW)\n",
335
  "while not board.winner:\n",
336
  " red.move(board)\n",
337
  " print(board)\n",
 
339
  " yellow.move(board)\n",
340
  " print(board)"
341
  ]
342
+ },
343
+ {
344
+ "cell_type": "code",
345
+ "execution_count": null,
346
+ "id": "f73d9d16-9658-4e85-8d46-f75e6adf7051",
347
+ "metadata": {},
348
+ "outputs": [],
349
+ "source": []
350
  }
351
  ],
352
  "metadata": {