Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- is_successful (s: M_MANCALA_SINGLE_STATE): BOOLEAN
- -- Given a state s, it decides whether the state is a
- -- success state, i.e., if it is one of the target states
- -- of the search.
- do
- Result := s.hole_content.is_empty or is_hole_content_empty(s)
- end
- feature{NONE} -- Helper feature
- is_hole_content_empty (s: M_MANCALA_SINGLE_STATE): BOOLEAN
- --Return true if hole_content has all 0's. Otherwise, false
- local
- i : INTEGER
- empty : BOOLEAN -- If true, hole_content is empty. Otherwise, it has elements
- do
- from
- empty := true
- i := 1
- until
- i > 12 or not empty
- loop
- if(s.get_hole_content (i) /= 0) then
- empty := false
- end
- end
- Result := empty
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement