Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96512

Re: Phone Tree

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Phone Tree
Date 2015-09-13 12:53 -0400
Organization IISS Elusive Unicorn
References <6ae5c632-b061-4b86-87ae-24c50435445b@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.484.1442163208.8327.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, 13 Sep 2015 07:39:23 -0700 (PDT), Azureaus <ltoshea@gmail.com>
declaimed the following:


>It states there should be at least 10 questions and that the user should reach a solution, e.g. 'replace your power cable'. There and my initial reaction was that this could be achieved by lots of if/else statements with each question running onto another one, ugly but it would certainly work. One of them pointed out how inefficient this was and asked if there was another way, they hated writing out tons of if/elif/else statements.
>

	Good for them... Separate the data from the algorithm/implementation.

>Does anyone have any ideas for a more elegant solution? My thoughts are that I could use a tree data structure and hence make traversing the tree recursive based on yes or no answers. I'm happy to put the time in to explain these more complex ideas, I'm just hoping those with more expertise than myself could either help verify the idea or suggest alternatives.

	Classical 20 questions implementation
http://www.c-sharpcorner.com/uploadfile/4a950c/20-questions-guessing-game-using-binary-trees/

	Even my college computer (late 70s) had a version. Most implementations
are designed to be self-learning -- that is, they start with only one
answer (or maybe even none) and if the guess is incorrect they ask the
player to provide a question that can be used to differentiate between the
its guess and the correct answer.

	True -- the efficiency of the result depends on the order the inputs
are provided as a key difference may end up at the bottom of a chain of
failed guesses, all of which could have been avoided if it had been the
first item. "is it alive?" as a first question would wipe out all the
inanimate stuff... But if the system was taught in the order "is it an
element"/"is it a mineral"/"is it a rock"/"is it alive"...

	


>
>Thanks in advance!
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Phone Tree Azureaus <ltoshea@gmail.com> - 2015-09-13 07:39 -0700
  Re: Phone Tree Chris Angelico <rosuav@gmail.com> - 2015-09-14 00:59 +1000
  Re: Phone Tree Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-13 12:53 -0400
  Re: Phone Tree Laura Creighton <lac@openend.se> - 2015-09-13 20:03 +0200
  Re: Phone Tree Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-13 23:57 +0000

csiph-web