Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions projects/1-explications/Zhong
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Chess engines are relatively recent inventions that completely altered the competitive chess world. Now any chess player training without a chess engine is severely disadvantaged against his/her competitors. One of the first chess AI, Deep Blue, debuted in the 90s and managed to take multiple games off of the world champion at that time, Garry Kasparov. The ability for chess engines to come up with strong moves have dramatically improved over the years. The strongest engines in the world are rated approximately with an elo of 3300, while the strongest players in the world only have an elo of 2800.

Komodo Dragon is a chess engine that is regarded as the strongest in the world by many Grandmasters and players alike. Komodo proved this by recently winning a competition amongst other chess engines such as Rybka and Fritz. The basis of the engine was written by Don Dailey and US chess grandmaster Larry Kaufman in the C language starting from the 1990s. The purpose of chess engines is to help players analyze their games, because the computer can come up with moves that humans would take forever to think of. Dailey and Kaufman wanted to create a chess engine like no other using new search algorithms and heuristics.

Most chess engines use the alpha-beta pruning search algorithm in order to give users the best moves, and search algorithms like alpha-beta pruning make up the central concept of the Komodo Dragon. However, Dailey implemented a new evaluation system that improved how the AI "thought" and the Komodo Dragon uses a knowledge based balance evaluation in order to trump its competitor engines. In addition, Kaufman has said that the engine uses some other techniques in order to think more like a human and make moves that wouldn’t seem artificial – something that many other engines have failed to do.
37 changes: 37 additions & 0 deletions projects/1-hello-world/zhong.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"Hi Joe! My name is Joey. I am from Toronto, Ontario, Canada and this is my first time visiting California. I am currently 16 years old and I am going into grade 11 next year. \n",
"\n",
"I have a decent amount of experience in compettive programming (i had reached gold in USACO). Outside of computing and programming, I am a avid chess player, swimmer, and badminton player. I hope that by the end of this course, I will learn a lot more about AI and hopefully bea ble to use the lessons in this coruse to create a project of my own. In addition, I hope to make new friends in the next three weeks."
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [Root]",
"language": "python",
"name": "Python [Root]"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -142,11 +142,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initial state: s1\n",
"Accepting? False\n",
"After a: s2\n",
"After ab: s3\n",
"Next steps: {'a': 's3'}\n",
"Accepting? True\n"
]
}
],
"source": [
"ab_a_ = StateMachine(\n",
" #We can define the states and edges in one go\n",
Expand Down Expand Up @@ -182,14 +195,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def check(sm, string):\n",
" return True # FIXME: if and only if `sm` accepts `string`."
" for c in string:\n",
" if c in sm.out_edges():\n",
" sm.advance(c)\n",
" else:\n",
" return False\n",
" return sm.is_terminal()\n",
"\n"
]
},
{
Expand All @@ -201,7 +220,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -241,18 +260,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 99,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def test2():\n",
" # TODO: define transition system here:\n",
" return StateMachine([],\n",
" return StateMachine([(\"s1\", \"x\", \"s2\"), (\"s2\", \"x\", \"s2\"), (\"s2\", \"@\", \"s3\"), (\"s3\", \"x\", \"s4\"),\n",
" (\"s4\", \"x\", \"s4\"), (\"s4\", \".\", \"s5\"), (\"s5\", \"x\", \"s6\"), (\"s6\", \"x\", \"s6\"), \n",
" (\"s1\", \".\", \"s7\"), (\"s7\", \"x\", \"s8\"), (\"s8\", \"x\", \"s8\"), (\"s8\", \"@\", \"s2\")], \n",
" \"s1\",\n",
" [])\n",
"# TODO: tests go here\n"
" [\"s6\"])\n",
"# TODO: tests go here\n",
"\n",
"\n",
"assert not check(test2(), \"@x.x\")\n",
"assert not check(test2(), \"[email protected]\")\n",
"assert not check(test2(), \"x@x.\")\n",
"assert not check(test2(), \"x@x\")\n",
"assert not check(test2(), \"x.x\")\n",
"assert not check(test2(), \"x@\")\n",
"assert not check(test2(), \"[email protected]\")\n",
"#assert check(test2(), \"xxx\")\n"
]
},
{
Expand All @@ -273,14 +304,52 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 120,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['x.x@x', 'xx.x@x', 'x.xx@x', 'x.x@xx', 'x.x@@x.', 'xxx.x@x', 'xx.xx@x', 'x.xxx@x', 'xx.x@xx', 'x.xx@xx', 'x.x@xxx', 'xx.x@@x.', 'x.xx@@x.', 'x.x@x@x.', 'x.x@@xx.', 'xxxx.x@x', 'xxx.xx@x', 'xx.xxx@x', 'x.xxxx@x', 'xxx.x@xx', 'xx.xx@xx', 'x.xxx@xx', 'xx.x@xxx', 'x.xx@xxx', 'x.x@xxxx', 'xxx.x@@x.', 'xx.xx@@x.', 'x.xxx@@x.', 'xx.x@x@x.', 'x.xx@x@x.', 'x.x@xx@x.', 'xx.x@@xx.', 'x.xx@@xx.', 'x.x@x@xx.', 'x.x@@xxx.', 'xxxxx.x@x', 'xxxx.xx@x', 'xxx.xxx@x', 'xx.xxxx@x', 'x.xxxxx@x', 'xxxx.x@xx', 'xxx.xx@xx', 'xx.xxx@xx', 'x.xxxx@xx', 'xxx.x@xxx', 'xx.xx@xxx', 'x.xxx@xxx', 'xx.x@xxxx', 'x.xx@xxxx', 'x.x@xxxxx', 'xxxx.x@@x.', 'xxx.xx@@x.', 'xx.xxx@@x.', 'x.xxxx@@x.', 'xxx.x@x@x.', 'xx.xx@x@x.', 'x.xxx@x@x.', 'xx.x@xx@x.', 'x.xx@xx@x.', 'x.x@xxx@x.', 'xxx.x@@xx.', 'xx.xx@@xx.', 'x.xxx@@xx.', 'xx.x@x@xx.', 'x.xx@x@xx.', 'x.x@xx@xx.', 'xx.x@@xxx.', 'x.xx@@xxx.', 'x.x@x@xxx.', 'x.x@@xxxx.', 'xxxxxx.x@x', 'xxxxx.xx@x', 'xxxx.xxx@x', 'xxx.xxxx@x', 'xx.xxxxx@x', 'x.xxxxxx@x', 'xxxxx.x@xx', 'xxxx.xx@xx', 'xxx.xxx@xx', 'xx.xxxx@xx', 'x.xxxxx@xx', 'xxxx.x@xxx', 'xxx.xx@xxx', 'xx.xxx@xxx', 'x.xxxx@xxx', 'xxx.x@xxxx', 'xx.xx@xxxx', 'x.xxx@xxxx', 'xx.x@xxxxx', 'x.xx@xxxxx', 'x.x@xxxxxx']\n"
]
}
],
"source": [
"def try_sample(sm, length):\n",
" return []"
"def dfs(sm, length, s):\n",
" if length == 0:\n",
" if sm.is_terminal():\n",
" return [s]\n",
" else:\n",
" return []\n",
" \n",
" temp = sm.state\n",
" ret = []\n",
" \n",
" for e in sm.out_edges():\n",
" sm.advance(e)\n",
" ret += dfs(sm, length - 1, e + s)\n",
" sm.state = temp\n",
" \n",
" return ret\n",
"\n",
"\n",
"assert len(dfs(test2(), 0, \"\")) == 0\n",
"assert len(dfs(test2(), 1, \"\")) == 0\n",
"assert len(dfs(test2(), 2, \"\")) == 0\n",
"assert len(dfs(test2(), 3, \"\")) == 0\n",
"assert len(dfs(test2(), 4, \"\")) == 0\n",
"assert len(dfs(test2(), 5, \"\")) == 1\n",
"assert len(dfs(test2(), 6, \"\")) == 3\n",
"assert len(dfs(test2(), 7, \"\")) == 7\n",
"assert len(dfs(test2(), 8, \"\")) == 14\n",
"\n",
"all_samples = []\n",
"for i in range(0, 11):\n",
" all_samples = all_samples + dfs(test2(), i, \"\")\n",
"print(all_samples)"
]
},
{
Expand Down Expand Up @@ -343,7 +412,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 65,
"metadata": {
"collapsed": true
},
Expand All @@ -369,11 +438,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 66,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"ename": "AssertionError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-66-9224806c1192>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m6\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msample\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m7\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m7\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAssertionError\u001b[0m: "
]
}
],
"source": [
"assert len(sample(test2(), 0)) == 0\n",
"assert len(sample(test2(), 1)) == 0\n",
Expand Down
Loading