On Dec 15, 2005, at 11:53 AM, Adam Shelly wrote: > There's nothing like a code review to make you see ways to improve > your code... > Based on James description of what #worst_case is doing I realized I > could rewrite it in 2 lines: > >> def worst_case board >> worst = 0 >> opp_board = board.rotate 7 >> 6.times {|i| >> s = score_for(opp_board, i) >> worst = s if worst < s >> } >> worst >> end >> end >> > >> The code above is very similar to the last player we examined. >> The main new >> element here is worst_case(), which is just a tool to find the >> opponent's best >> move (worst for us). > > So this function should simply be: > def worst_case board > opp_board = board.rotate 7 > score_for(opp_board,best_move(opp_board)) > end Hey, I like that. > Thanks for runing these always entertaining and educational quizes, > James. Thanks for giving me something to talk about, Adam. ;) James Edward Gray II