Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Possible to dynamically pass arguments to a function?
Post: RE: Possible to dynamically pass arguments to a fu...

Nevermind, I figured it out. color = [chess.BLACK, chess.WHITE] square = [chess.A7, chess.C7] a = 1 attackers = board.attackers(color[a], square[a])If anybody else ever wants to do this, here's how...
grimm1111 General Coding Help 2 2,201 Feb-21-2021, 05:44 AM
    Thread: Possible to dynamically pass arguments to a function?
Post: Possible to dynamically pass arguments to a functi...

Hello, Probably a newbie question here.... but is there any way to dynamically pass arguments to a function? I am accessing a class from someone else's code, and I can't modify it. attackers = boar...
grimm1111 General Coding Help 2 2,201 Feb-21-2021, 05:26 AM
    Thread: Problem with an iterator
Post: RE: Problem with an iterator

(Feb-06-2021, 04:44 PM)deanhystad Wrote: This should work. It uses list() to replace the code that built the moves_list. def move_picker(game): board = game.board() num_moves = random.randi...
grimm1111 General Coding Help 9 4,342 Feb-06-2021, 09:22 PM
    Thread: Problem with an iterator
Post: RE: Problem with an iterator

(Feb-06-2021, 05:57 AM)deanhystad Wrote: You will want to use board.push(). I don't have the chess package so I used something else for testing. Forgot to switch the code back to push() when I was...
grimm1111 General Coding Help 9 4,342 Feb-06-2021, 08:28 AM
    Thread: Problem with an iterator
Post: RE: Problem with an iterator

(Feb-06-2021, 05:00 AM)deanhystad Wrote: This makes no sense: def move_picker(the_game): Move_val = random.randint(10,40) board3 = the_game.board() for Move_val in the_game.mainline_move...
grimm1111 General Coding Help 9 4,342 Feb-06-2021, 05:45 AM
    Thread: Problem with an iterator
Post: RE: Problem with an iterator

Thank you very much for the reply. You're absolutely right about the scope issue, I've been researching this for the last couple hours and found the same thing. When I run the code as you've written...
grimm1111 General Coding Help 9 4,342 Feb-06-2021, 03:45 AM
    Thread: Problem with an iterator
Post: Problem with an iterator

Hello, I am trying to write a chess program that grabs a random chess position, sends the position to an evaluation engine, and returns both the position and the evaluation. I am using three librari...
grimm1111 General Coding Help 9 4,342 Feb-06-2021, 02:11 AM

User Panel Messages

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