Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_piece_to_drop(params):
- # pieces_in_danger should be a list
- pieces_in_danger = get_pieces_in_danger(...params)
- # for each piece in pieces_in_danger match the state of the
- # game/board after it (the piece) has been removed. On all the states Si
- # found via the previous mapping, calculate the image of Si by F
- # (utility function) then choose the one or one that minimise F.
- states_after_dropping_piece = []
- for piece in pieces_in_danger:
- # must implement drop_piece first
- # drop_piece(...) put None into the pieces cellules and increment/update
- # the actuelle payer captured_pieces.
- states_after_dropping_piece.append(drop_piece(...params, piece)):
- utility_values = []
- for state in states:
- utility_values.append(compute_utilty(state)) # for ennemy cause it is her tour.
- # we have now to get the index idx of utility_values minimun, which will help use
- # retrieve the best droppable piece doing pieces_in_danger[idx]
- # I assume that the such function helping us to get idx is
- # get_index_of(value, tab_of_values_in_which_to_search)
- idx = get_index_of(min(utility_values), utility)
- return pieces_in_danger[idx]
- def get_pieces_in_danger(...params):
- # it seems like we already have function doing this job
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement