tictactoe script - commented - may have pedagogical value

2017-09-04 Thread namenobodywants
""" this program makes an optimal tictactoe move by answering the following questions in their given order until it is told where to put its mark: 1) can you win the game? if so then do it 2) could your opponent win the game if it was his turn? if so then put your own mark where a mar

seeking advice about strategic-game ai

2017-09-05 Thread namenobodywants
i plan to try writing an ai for a strategic game, and i've pretty much narrowed the candidates down to either checkers or reversi. i would prefer to tackle the easier game, so can anybody tell me which one is easier to program decently? (or maybe i'm missing a good candidate - basically all i

Re: tictactoe script - commented - may have pedagogical value

2017-09-05 Thread namenobodywants
good point. this algorithm doesn't take account of the fact that one can make a threat (x's 147) by parrying a threat (o's 357). nevertheless i'm still certain that the components the algorithm is built from are the same components i use myself to play tictactoe, and i'm still certain that my ow

connect four (game)

2017-11-24 Thread namenobodywants
hi all i've just finished my first excursion into artificial intelligence with a game less trivial than tictactoe, and here it is in case anybody can offer criticism/suggestions/etc peace stm ### #) connectfour - python 3.6.1 ### from t

Re: connect four (game)

2017-11-24 Thread namenobodywants
On Friday, November 24, 2017 at 12:13:18 PM UTC-8, Terry Reedy wrote: > Since you did not start with tests or write tests as you wrote code, ... why on earth would you assume that? instantiate "window" and you'll see it works exactly as i intended; nobody's asking you to debug code for free; i'm

Re: connect four (game)

2017-11-25 Thread namenobodywants
On Saturday, November 25, 2017 at 5:00:12 AM UTC-8, bartc wrote: > Actually I've no idea what these tests are supposed to prove. me neither; i think you guys may be getting me out of my depth now > They are to do with one class called 'infinity', which is never used in the > rest > of the pr

Re: connect four (game)

2017-11-25 Thread namenobodywants
On Friday, November 24, 2017 at 8:07:07 AM UTC-8, Chris Angelico wrote: > This is the kind of function that needs a docstring and some comments. > What exactly is this doing? What are the "lines" of the board? What's > the difference between "linear" and "lines"? What exactly is it > returning? p

Re: connect four (game)

2017-11-25 Thread namenobodywants
On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: > I did, and it looks buggy to me. The top and left frame lines are > missing. If I click a square, the bottom square in the column lights > up. But then I have no idea whether those are your intentions or not. i hadn't

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Friday, November 24, 2017 at 8:07:07 AM UTC-8, Chris Angelico wrote: > This is the kind of function that needs a docstring and some comments. > What exactly is this doing? What are the "lines" of the board? What's > the difference between "linear" and "lines"? What exactly is it > returning? p

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Saturday, November 25, 2017 at 5:00:12 AM UTC-8, bartc wrote: > Actually I've no idea what these tests are supposed to prove. me neither; i think you guys may be getting me out of my depth now > They are to do with one class called 'infinity', which is never used in the rest > of the program

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: > I did, and it looks buggy to me. The top and left frame lines are > missing. If I click a square, the bottom square in the column lights > up. But then I have no idea whether those are your intentions or not. i hadn't no

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Saturday, November 25, 2017 at 5:00:12 AM UTC-8, bartc wrote: > Actually I've no idea what these tests are supposed to prove. me neither; i think you guys may be getting me out of my depth now > They are to do with one class called 'infinity', which is never used in the rest > of the program

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Friday, November 24, 2017 at 8:07:07 AM UTC-8, Chris Angelico wrote: > This is the kind of function that needs a docstring and some comments. > What exactly is this doing? What are the "lines" of the board? What's > the difference between "linear" and "lines"? What exactly is it > returning? p

Re: connect four (game)

2017-11-26 Thread namenobodywants
On Saturday, November 25, 2017 at 12:48:38 AM UTC-8, Terry Reedy wrote: > I did, and it looks buggy to me. The top and left frame lines are > missing. If I click a square, the bottom square in the column lights > up. But then I have no idea whether those are your intentions or not. i hadn't no

Re: connect four (game)

2017-11-27 Thread namenobodywants
On Sunday, November 26, 2017 at 7:09:25 PM UTC-8, Michael Torrie wrote: > So you are using this Infinity class as a sentinel value of some kind? > Representing game state? There may be an easier way than a full on > custom type. Sometimes just a sentinel object is sufficient. Or an > enumerati

Re: connect four (game)

2017-11-27 Thread namenobodywants
On Monday, November 27, 2017 at 2:10:56 AM UTC-8, Chris Angelico wrote: > Or you could use the floating-point values for positive and negative > infinity perfecto! thank you! peace stm -- https://mail.python.org/mailman/listinfo/python-list

Re: connect four (game)

2017-11-27 Thread namenobodywants
On Sunday, November 26, 2017 at 7:09:25 PM UTC-8, Michael Torrie wrote: > So you are using this Infinity class as a sentinel value of some kind? > Representing game state? There may be an easier way than a full on > custom type. Sometimes just a sentinel object is sufficient. Or an > enumeratio

Re: connect four (game)

2017-11-27 Thread namenobodywants
On Monday, November 27, 2017 at 2:10:56 AM UTC-8, Chris Angelico wrote: > Or you could use the floating-point values for positive and negative > infinity perfecto! thank you! peace stm -- https://mail.python.org/mailman/listinfo/python-list

correctness proof for alpha-beta algorithm

2017-12-18 Thread namenobodywants
hi all can anybody tell me where to look for a proof of the correctness of a minimax/negamax algorithm with alpha-beta pruning? thanks if you can help peace stm -- https://mail.python.org/mailman/listinfo/python-list

Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread namenobodywants
On Monday, December 18, 2017 at 10:16:07 PM UTC-8, Terry Reedy wrote: > Where or how have you looked so far? How formal do you want? i want full-on formal with lots of rigor and every possible detail spelled out; i've looked in a couple of books but my best lead so far is a paper by knuth call

Re: correctness proof for alpha-beta algorithm

2017-12-20 Thread namenobodywants
On Tuesday, December 19, 2017 at 3:28:39 PM UTC-8, Steve D'Aprano wrote: > Does this have anything specifically to do with Python programming? i'm working on a game-playing script (ie: in python), i want to incorporate pruning into my search algorithm, and i'd like to understand why it works; i'

Re: correctness proof for alpha-beta algorithm

2017-12-20 Thread namenobodywants
On Tuesday, December 19, 2017 at 5:34:17 PM UTC-8, Paul Rubin wrote: > It frankly sounds like homework. https://en.wikipedia.org/wiki/Theorem -- https://mail.python.org/mailman/listinfo/python-list

unintuitive for-loop behavior

2016-09-29 Thread namenobodywants
hello pythonistas i've had a nodding acquaintance with python for some time, and all along i assumed that for-loops got a namespace of their own; now i'm reading up on the language and i find out that's not the case: the loop variable gets put into the enclosing namespace, overwriting any forme

tkinter callbacks stop working

2016-10-21 Thread namenobodywants
hello pythonistas the script below plays tictactoe; everything works; but if i replace the block at the bottom if True: with this instead def function(): function() then the tkinter callbacks don't work anymore; can anybody make sense of this? thanks if you can help peace stm ps:

how to get python version ?

2016-01-27 Thread namenobodywants
hi is there something analogous to sys.platform that lets you get the version of python you're using? sorry if the question is too see-spot-run. thanks if you can help peace stm -- https://mail.python.org/mailman/listinfo/python-list