Sasha Rush commited on
Commit
24b2eb2
1 Parent(s): 617cc02

Release v0.1

Browse files
Files changed (1) hide show
  1. GPT4_game.ipynb +20 -14
GPT4_game.ipynb CHANGED
@@ -7,7 +7,7 @@
7
  "colab_type": "text"
8
  },
9
  "source": [
10
- "<a href=\"https://colab.research.google.com/github/srush/GPTWorld-Challenge/blob/main/GPT4_game.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
11
  ]
12
  },
13
  {
@@ -38,12 +38,13 @@
38
  },
39
  {
40
  "cell_type": "code",
41
- "execution_count": 44,
42
  "metadata": {
43
  "id": "gKzCE5A7aGWY"
44
  },
45
  "outputs": [],
46
  "source": [
 
47
  "%%capture\n",
48
  "!sudo apt-get install libcairo2-dev\n",
49
  "!pip install -U git+https://github.com/chalk-diagrams/chalk openai pycairo tiktoken"
@@ -60,13 +61,14 @@
60
  },
61
  {
62
  "cell_type": "code",
63
- "execution_count": 2,
64
  "metadata": {
65
- "id": "RWUExPo7Y8-O"
 
66
  },
67
  "outputs": [],
68
  "source": [
69
- "\n",
70
  "from dataclasses import dataclass\n",
71
  "from chalk import *\n",
72
  "from colour import Color\n",
@@ -133,12 +135,15 @@
133
  },
134
  {
135
  "cell_type": "code",
136
- "execution_count": 54,
137
  "metadata": {
138
- "id": "Fv3eTRKiV2ZB"
 
139
  },
140
  "outputs": [],
141
  "source": [
 
 
142
  "# Possible Actions\n",
143
  "class Actions(Enum):\n",
144
  " UPRIGHT = \"UR\"\n",
@@ -256,6 +261,7 @@
256
  {
257
  "cell_type": "code",
258
  "source": [
 
259
  "def draw_board(grid, num=0):\n",
260
  " hex = regular_polygon(6, 1).rotate_by(1/12).line_width(0.5).fill_color(Color(\"white\"))\n",
261
  " w = hex.get_envelope().width\n",
@@ -291,7 +297,7 @@
291
  "id": "Ic7WgOTi8uF1",
292
  "outputId": "4dc07cb9-9e5f-4d28-d4ea-470ad4b13141"
293
  },
294
- "execution_count": 76,
295
  "outputs": [
296
  {
297
  "output_type": "execute_result",
@@ -367,7 +373,7 @@
367
  "id": "nqgPKLu0AMhU",
368
  "outputId": "19e4c6d0-b792-4a34-f4c4-81902974c346"
369
  },
370
- "execution_count": 78,
371
  "outputs": [
372
  {
373
  "output_type": "display_data",
@@ -502,13 +508,13 @@
502
  },
503
  {
504
  "cell_type": "code",
505
- "execution_count": 102,
506
  "metadata": {
507
  "id": "jFf7TCOJaVHX"
508
  },
509
  "outputs": [],
510
  "source": [
511
- "\n",
512
  "def make_fun(board, actions):\n",
513
  " \"This function generates python code for few-shot examples\"\n",
514
  " out = tab + \"p = \" + str(board.player_pos)\n",
@@ -607,7 +613,7 @@
607
  "id": "cOneYFok_OMe",
608
  "outputId": "97080186-7322-4ba9-b500-095fb39071aa"
609
  },
610
- "execution_count": 103,
611
  "outputs": [
612
  {
613
  "output_type": "stream",
@@ -669,7 +675,7 @@
669
  },
670
  {
671
  "cell_type": "code",
672
- "execution_count": 105,
673
  "metadata": {
674
  "id": "LONWUsBLjOHo",
675
  "colab": {
@@ -967,7 +973,7 @@
967
  "metadata": {
968
  "colab": {
969
  "provenance": [],
970
- "authorship_tag": "ABX9TyMCVv6YyI0lCdACYaFERyNc",
971
  "include_colab_link": true
972
  },
973
  "kernelspec": {
 
7
  "colab_type": "text"
8
  },
9
  "source": [
10
+ "<a href=\"https://colab.research.google.com/github/srush/GPTWorld/blob/main/GPT4_game.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
11
  ]
12
  },
13
  {
 
38
  },
39
  {
40
  "cell_type": "code",
41
+ "execution_count": null,
42
  "metadata": {
43
  "id": "gKzCE5A7aGWY"
44
  },
45
  "outputs": [],
46
  "source": [
47
+ "#@title Install (collapse me)\n",
48
  "%%capture\n",
49
  "!sudo apt-get install libcairo2-dev\n",
50
  "!pip install -U git+https://github.com/chalk-diagrams/chalk openai pycairo tiktoken"
 
61
  },
62
  {
63
  "cell_type": "code",
64
+ "execution_count": null,
65
  "metadata": {
66
+ "id": "RWUExPo7Y8-O",
67
+ "cellView": "form"
68
  },
69
  "outputs": [],
70
  "source": [
71
+ "#@title Import (collapse me)\n",
72
  "from dataclasses import dataclass\n",
73
  "from chalk import *\n",
74
  "from colour import Color\n",
 
135
  },
136
  {
137
  "cell_type": "code",
138
+ "execution_count": null,
139
  "metadata": {
140
+ "id": "Fv3eTRKiV2ZB",
141
+ "cellView": "form"
142
  },
143
  "outputs": [],
144
  "source": [
145
+ "#@title Game Code\n",
146
+ "\n",
147
  "# Possible Actions\n",
148
  "class Actions(Enum):\n",
149
  " UPRIGHT = \"UR\"\n",
 
261
  {
262
  "cell_type": "code",
263
  "source": [
264
+ "#@title Drawing code\n",
265
  "def draw_board(grid, num=0):\n",
266
  " hex = regular_polygon(6, 1).rotate_by(1/12).line_width(0.5).fill_color(Color(\"white\"))\n",
267
  " w = hex.get_envelope().width\n",
 
297
  "id": "Ic7WgOTi8uF1",
298
  "outputId": "4dc07cb9-9e5f-4d28-d4ea-470ad4b13141"
299
  },
300
+ "execution_count": null,
301
  "outputs": [
302
  {
303
  "output_type": "execute_result",
 
373
  "id": "nqgPKLu0AMhU",
374
  "outputId": "19e4c6d0-b792-4a34-f4c4-81902974c346"
375
  },
376
+ "execution_count": null,
377
  "outputs": [
378
  {
379
  "output_type": "display_data",
 
508
  },
509
  {
510
  "cell_type": "code",
511
+ "execution_count": null,
512
  "metadata": {
513
  "id": "jFf7TCOJaVHX"
514
  },
515
  "outputs": [],
516
  "source": [
517
+ "#@title Make the Prompt\n",
518
  "def make_fun(board, actions):\n",
519
  " \"This function generates python code for few-shot examples\"\n",
520
  " out = tab + \"p = \" + str(board.player_pos)\n",
 
613
  "id": "cOneYFok_OMe",
614
  "outputId": "97080186-7322-4ba9-b500-095fb39071aa"
615
  },
616
+ "execution_count": null,
617
  "outputs": [
618
  {
619
  "output_type": "stream",
 
675
  },
676
  {
677
  "cell_type": "code",
678
+ "execution_count": null,
679
  "metadata": {
680
  "id": "LONWUsBLjOHo",
681
  "colab": {
 
973
  "metadata": {
974
  "colab": {
975
  "provenance": [],
976
+ "authorship_tag": "ABX9TyNFpIRGCX0LXC26SCWsfp30",
977
  "include_colab_link": true
978
  },
979
  "kernelspec": {