Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'elegant': 0.07; 'none)': 0.07; 'ugly': 0.07; 'incorrect': 0.09; 'message-id:@4ax.com': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'suggest': 0.15; '"is': 0.16; '(late': 0.16; '>does': 0.16; 'advance!': 0.16; 'inputs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'pointed': 0.18; 'thoughts': 0.18; 'tree': 0.18; 'url:home': 0.18; 'version.': 0.18; '2015': 0.20; 'item.': 0.22; 'sep': 0.22; '(or': 0.23; 'player': 0.23; 'header:X-Complaints-To:1': 0.26; 'separate': 0.27; 'least': 0.27; 'question': 0.27; 'correct': 0.28; 'idea': 0.28; 'initial': 0.28; 'solution,': 0.29; 'asked': 0.29; "i'm": 0.30; 'work.': 0.30; 'certainly': 0.30; 'e.g.': 0.30; 'guess': 0.31; 'anyone': 0.32; 'another': 0.32; 'maybe': 0.33; '-0700': 0.33; 'structure': 0.34; 'running': 0.34; 'could': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'one,': 0.37; 'charset :us-ascii': 0.37; 'difference': 0.38; 'end': 0.39; 'data': 0.39; 'to:addr:python.org': 0.40; 'questions': 0.40; 'your': 0.60; 'provide': 0.61; 'reach': 0.61; 'yes': 0.62; 'more': 0.63; 'between': 0.65; 'college': 0.67; 'answer.': 0.72; 'power': 0.72; 'hoping': 0.77; 'wipe': 0.84; 'dennis': 0.91; 'inefficient': 0.91; 'received:108': 0.93; 'taught': 0.97 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Phone Tree Date: Sun, 13 Sep 2015 12:53:07 -0400 Organization: IISS Elusive Unicorn References: <6ae5c632-b061-4b86-87ae-24c50435445b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-68-178-61.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442163208 news.xs4all.nl 23757 [2001:888:2000:d::a6]:44749 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96512 On Sun, 13 Sep 2015 07:39:23 -0700 (PDT), Azureaus 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/