Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python No problem, and as you'd guessed changing lines like "while (x > 0) and (y < 7):" to "while (x > 0) and (y < len(board)-1):" would work fine for arbitrary grid sizes. URL: http://forum.audiogames.net/viewtopic.php?pid=255029#p255029 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Eurika! Thanks much, @magurp244. I now have a working solution. URL: http://forum.audiogames.net/viewtopic.php?pid=255027#p255027 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python I wonder if I can take your implementation of the eight queens and adjust it to fit an arbitrary m by n board?It looks like we're doing length(board)-1 for diagonal cases. Is this just an observation for this particular case, or would this actually work? Furthermore, how can you iterate over a tuple using a while loop? URL: http://forum.audiogames.net/viewtopic.php?pid=255022#p255022 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Just find the coordinates of the point and the queen. Find the difference in coordinates (say, dy for p2.y-p1.y) and the same for dx.Now you're subtracting one set from another, so you're essentially finding the location of the second queen compared to the first. If its a diagonal, the x and y distances have to be the same. Therefore, check the absolute values on dy and dx are equal. URL: http://forum.audiogames.net/viewtopic.php?pid=255019#p255019 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Just find the coordinates of the point and the queen. Find the difference in coordinates (say, dy for p2.y-p1.y) and the same for dx.Now you're subtracting one set from another, so you're essentially finding the location of the second queen compared to the first. If its a diagonal, then the absolute value of dy/dx will be 1, because if its a diagonal, then it has to be the exact same x distance as y distance from the first one. Just remember if using python to make the values float first or could you get erroneous results. URL: http://forum.audiogames.net/viewtopic.php?pid=255019#p255019 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Hm, so am I to assume that [(0,0),(0,1)] is a set of coordinates for 0,0, and 0,1, on the grid? Are you looking for the distance between the given position and queens? Given your example, what would the output your looking for look like? URL: http://forum.audiogames.net/viewtopic.php?pid=254921#p254921 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Hmm. I think I confuse you a bit, my apoligies.The board is of arbritrary length, and we want a location of queens relative to the given location.diagonal_conflict([[True, True], [False, False]], 0, 1)My coords function would take this input and say that queens are at [(0, 0) (0, 1)] I am not sure of the requisite algebra to do next. URL: http://forum.audiogames.net/viewtopic.php?pid=254917#p254917 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python I think this might work:#build 8x8 chess board grid board = [] for a in xrange(0,8,1): board.append([]) for b in xrange(0,8,1): board[a].append(0) #set position of a queen board[1][3] = 1 #diagonal queen finder def find(row,column): #list for storing coords of found queens queen = [] #search lower left x = row y = column while (x > 0) and (y > 0): x -= 1 y -= 1 if board[y][x] == 1: queen.append([x,y]) print 'Queen Found' #search lower right x = row y = column while (x < 7) and (y > 0): x += 1 y -= 1 if board[y][x] == 1: queen.append([x,y]) print 'Queen Found' #search upper left x = row y = column while (x > 0) and (y < 7): x -= 1 y += 1 if board[y][x] == 1: queen.append([x,y]) print 'Queen Found' #search upper right x = row y = column while (x < 7) and (y < 7): x += 1 y += 1 if board[y][x] == 1: queen.append([x,y]) print 'Queen Found' return queen find(6,4) URL: http://forum.audiogames.net/viewtopic.php?pid=254915#p254915 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python The object is to see if a queen occupies a diagonal that is in line with the specified (row, column) parameter. The queens are booleans, True means there is a queen, False means there is not a queen. URL: http://forum.audiogames.net/viewtopic.php?pid=254906#p254906 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: How to Determine a Column Conflict in Python
Re: How to Determine a Column Conflict in Python Could you be more specific? Do you mean a board of queens as in a Chess Board? What constitutes a conflict? Is it to determine if an object is along a given path? Or to see if two objects intersect? URL: http://forum.audiogames.net/viewtopic.php?pid=254799#p254799 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
How to Determine a Column Conflict in Python
How to Determine a Column Conflict in Python Hello,I am trying to see if there is a column conflict given a board of queens and a given row and column. Aside from creating the function that returns a list of tuples of coordinates, I am stuck as to what to do next, which is quite laughable, as finding a row and column conflict were easy enough and my geometry skills are illuding me now. URL: http://forum.audiogames.net/viewtopic.php?pid=254791#p254791 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector