Closed otizonaizit closed 3 years ago
I think the switching bots #43 and new documentation #46 adress this. Can be closed?
Yeah, closing for now. I don’t think we have a really good solution for the points that have been raised. Testing the second bot with an empty state dict with the expectation that it this will initialise the state is also wrong. The code may work, but the implicit assumption in the move function will always be that state == {}
⇔ bot.round == 1 and bot.turn == 0
.
I’ll see if I can improve the code comments some more.
After mergin #33 , we have
state
as a dictionary. In the demos it is now routinely initialized asI think this leaves the same questions open that we got from the student when that code looked like this:
namely, when is the condition
True
during the game? Of course we can explain in the docs thatstate
is an empty dictionary and you can initialize it how you want and when you want. Still, I think that in the demos the condition should be something like:which makes it clear when the state gets initialized. The downside of my proposal is that if one wants to write a test for the "second" bot, i.e. when
bot.turn==1
, then the state may need to be initialized manually beofrehand and passed into themove
function during the test, instead of having the conditionif state == {}
take care of it automatically. My opinion is that we can have tests for the "second" bot where we show how to initialize the state, maybe even showing that it is good practice to first testbot.turn==0
and only after that test thebot.turn==1
case, by using the modifiedstate
coming from the first call to themove
function.Follow up here for a discussion...