+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Getting a game state\n",
+ "If we need the guesser to interact with a human, let's get it to read the game state from a human.\n",
+ "\n",
+ "Remember that we want to return two lists of characters, not two strings.\n",
+ "\n",
+ "We'll also not do any input validation. Life's too short (for this example)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "def read_game():\n",
+ " discovered = input('Enter the discovered word: ')\n",
+ " missed = input('Enter the wrong guesses: ')\n",
+ " return list(discovered), list(missed)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "read_game()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter the discovered word: __pp_\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter the wrong guesses: xv\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 19,
+ "text": [
+ "(['_', '_', 'p', 'p', '_'], ['x', 'v'])"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "That was easy."
+ ]
+ },