obviously homework.... The questionsuggests you already have a function that pretty much does what it is you're supposed to do, you just have to make the changes you're told to make and write a new function to to just that.
You don't see the the board array? it's the first chunk of code you posted.
if this really is homework, ask your instructor these same exact questions, that's what you're paying him for.