Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. def get_piece_to_drop(params):
  2.     # pieces_in_danger should be a list
  3.     pieces_in_danger = get_pieces_in_danger(...params)
  4.  
  5.     # for each piece in pieces_in_danger match the state of the
  6.     # game/board after it (the piece) has been removed. On all the states Si
  7.     # found via the previous mapping, calculate the image of Si by F
  8.     # (utility function) then choose the one or one that minimise F.
  9.     states_after_dropping_piece = []
  10.     for piece in pieces_in_danger:
  11.         # must implement drop_piece first
  12.         # drop_piece(...) put None into the pieces cellules and increment/update
  13.         # the actuelle payer captured_pieces.
  14.         states_after_dropping_piece.append(drop_piece(...params, piece)):
  15.    
  16.     utility_values = []
  17.     for state in states:
  18.         utility_values.append(compute_utilty(state)) # for ennemy cause it is her tour.
  19.  
  20.     # we have now to get the index idx of utility_values minimun, which will help use
  21.     # retrieve the best droppable piece doing pieces_in_danger[idx]
  22.     # I assume that the such function helping us to get idx is
  23.     # get_index_of(value, tab_of_values_in_which_to_search)
  24.     idx = get_index_of(min(utility_values), utility)
  25.     return pieces_in_danger[idx]    
  26.  
  27.  
  28.  
  29. def get_pieces_in_danger(...params):
  30.     # it seems like we already have function doing this job
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement