Python Forum
is there a way to optimize my checking system?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there a way to optimize my checking system?
#5
For checking the winner sets might be useful. Just general idea:

>>> first = 'xoo'
>>> second = 'xxx'
>>> third = 'oox'
>>> [row[0] for row in [first, second, third] if len(set(row)) == 1]  # for rows
['x']
>>> set([row[i] for i, row in enumerate([first, second, third])])     # for main diagonal                        
{'x'}
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: is there a way to optimize my checking system? - by perfringo - Oct-13-2019, 09:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I multithread to optimize a groupby task: davisc4468 0 782 Jun-30-2023, 02:45 PM
Last Post: davisc4468
  do you have an idea to optimize this code[recursion]]? netanelst 4 1,383 May-20-2022, 06:41 PM
Last Post: jefsummers
  Optimization using scipy.optimize KaneBilliot 3 1,983 Nov-30-2021, 08:03 AM
Last Post: Gribouillis
  Using curve_fit to optimize function (TypeError) Laplace12 4 2,643 Aug-30-2021, 11:15 AM
Last Post: Larz60+
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,851 Jan-11-2021, 06:30 PM
Last Post: ykumar34
Question Difference between Python's os.system and Perl's system command Agile741 13 7,049 Dec-02-2019, 04:41 PM
Last Post: Agile741
  cannot import scipy.optimize.Bounds larkypython 2 7,365 May-05-2019, 04:09 AM
Last Post: larkypython
  Optimize unittest loading Nazz 3 2,628 Mar-05-2019, 11:59 AM
Last Post: Nazz
  optimize choices in multiple if ---: statements Pedroski55 2 2,958 Dec-25-2018, 05:06 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020