Advertisement
Guest User

project

a guest
Nov 26th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Eiffel 0.74 KB | None | 0 0
  1. is_successful (s: M_MANCALA_SINGLE_STATE): BOOLEAN
  2.             -- Given a state s, it decides whether the state is a
  3.             -- success state, i.e., if it is one of the target states
  4.             -- of the search.
  5.         do
  6.             Result := s.hole_content.is_empty or is_hole_content_empty(s)
  7.         end
  8.  
  9. feature{NONE} -- Helper feature
  10.     is_hole_content_empty (s: M_MANCALA_SINGLE_STATE): BOOLEAN
  11.             --Return true if hole_content has all 0's. Otherwise, false
  12.  
  13.             local
  14.                 i : INTEGER
  15.                 empty : BOOLEAN  -- If true, hole_content is empty. Otherwise, it has elements
  16.             do
  17.                 from
  18.                     empty := true
  19.                     i := 1
  20.                 until
  21.                     i > 12 or not empty
  22.                 loop
  23.                     if(s.get_hole_content (i) /= 0) then
  24.                         empty := false
  25.                     end
  26.                 end
  27.  
  28.                 Result := empty
  29.             end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement