Add files via upload
This commit is contained in:
@@ -40,8 +40,8 @@
|
||||
"\n",
|
||||
"- A **valid word** is a string of at least 4 letters, with no 'S', and not more than 7 distinct letters.\n",
|
||||
"- A **word list** is, well, a list of words.\n",
|
||||
"- A **pangram** is a word with exactly 7 distinct letters.\n",
|
||||
"- The **word score** is 1 for a four letter word, or the length of the word for longer words, plus a bonus of 7 for a pangram.\n"
|
||||
"- A **pangram** is a word with exactly 7 distinct letters; it scores a **pangram bonus** of 7 points.\n",
|
||||
"- The **word score** is 1 for a four letter word, or the length of the word for longer words, plus any pangram bonus.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -207,9 +207,10 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def game_score(honeycomb, words) -> int:\n",
|
||||
"def game_score(honeycomb, wordlist) -> int:\n",
|
||||
" \"\"\"The total score for this honeycomb.\"\"\"\n",
|
||||
" return sum(word_score(w) for w in words if can_make(honeycomb, w))\n",
|
||||
" return sum(word_score(w) \n",
|
||||
" for w in wordlist if can_make(honeycomb, w))\n",
|
||||
"\n",
|
||||
"def can_make(honeycomb, word) -> bool:\n",
|
||||
" \"\"\"Can the honeycomb make this word?\"\"\"\n",
|
||||
@@ -355,20 +356,20 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[Honeycomb(letters='AEGLMPX', center='A'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='E'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='G'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='L'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='M'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='P'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='X'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='A'),\n",
|
||||
"[Honeycomb(letters='ACEIORT', center='A'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='C'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='E'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='I'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='O'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='R'),\n",
|
||||
" Honeycomb(letters='ACEIORT', center='T')]"
|
||||
" Honeycomb(letters='ACEIORT', center='T'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='A'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='E'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='G'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='L'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='M'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='P'),\n",
|
||||
" Honeycomb(letters='AEGLMPX', center='X')]"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
@@ -535,8 +536,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: user 9.11 ms, sys: 204 µs, total: 9.32 ms\n",
|
||||
"Wall time: 9.12 ms\n"
|
||||
"CPU times: user 9.77 ms, sys: 35 µs, total: 9.8 ms\n",
|
||||
"Wall time: 9.8 ms\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -756,8 +757,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: user 1.76 s, sys: 1.59 ms, total: 1.76 s\n",
|
||||
"Wall time: 1.76 s\n"
|
||||
"CPU times: user 1.81 s, sys: 2.31 ms, total: 1.82 s\n",
|
||||
"Wall time: 1.82 s\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -863,8 +864,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"CPU times: user 393 ms, sys: 943 µs, total: 394 ms\n",
|
||||
"Wall time: 393 ms\n"
|
||||
"CPU times: user 406 ms, sys: 1.13 ms, total: 407 ms\n",
|
||||
"Wall time: 406 ms\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user