-- Automatic generation produced by ISE Eiffel --
class interface
GAME_MANAGER
create
make (no_cards: INTEGER)
-- Set the number of cards and create the game.
require
minimum_amount_of_cards: no_cards > 0
feature -- Access
Card_offset: INTEGER is 3
-- The offset of a card_number and first_card
-- (from GAME_CONSTANTS)
cards_in_drawing_order: LINKED_LIST [INTEGER]
-- A LINKED_LIST of the card numbers in drawing order,
-- so the cards will overlap correctly when drawn.
Column_offset: INTEGER is 4
-- A column is identified in the movement by its number + 4
-- (from GAME_CONSTANTS)
deal_game
-- Deal the game.
First_card: INTEGER is 4
-- The first card number in the game
-- (from GAME_CONSTANTS)
goal_state_reached: BOOLEAN
-- Is the game in the goal_state?
Home_cell_offset: INTEGER is 12
-- A home_cell is identified in the movement by its number + 12
-- (from GAME_CONSTANTS)
initialize_the_cards
-- Initialize each card in the game, by
-- setting its coordinates.
Maximum_game_number: INTEGER is 65000
-- Maximum game number to play
-- (from GAME_CONSTANTS)
Maximum_number_of_cards: INTEGER is 52
-- Maximum number of cards to play with
-- (from GAME_CONSTANTS)
Most_left_x_position: INTEGER is 20
-- Defines the space between the cards
-- and the left border of the window
-- (from GAME_CONSTANTS)
Most_top_y_position: INTEGER is 10
-- Most top y_position of a card.
-- This position is equal to the y_position
-- of the home_cells and the "xcells"
-- (from GAME_CONSTANTS)
Number_of_cells: INTEGER is 4
-- Number of cells for each kind of cell
-- (from GAME_CONSTANTS)
Number_of_columns: INTEGER is 8
-- Number of columns present in the game
-- (from GAME_CONSTANTS)
reset_destination
-- Resets the destination of the move status
require
destination_is_selected: destination_selected
ensure
no_destination: not destination_selected
reset_move_status
-- Resets the move status
require
source_is_selected: source_selected
destination_is_selected: destination_selected
ensure
no_destination: not destination_selected
no_source: not source_selected
reset_source
-- Resets the source of the move status
require
source_is_selected: source_selected
ensure
no_source: not source_selected
select_destination (x_pos, y_pos: INTEGER)
select_destination_home_cell
-- Select the home_cell corresponding
-- to the kind of the card
require
no_destination: not destination_selected
ensure
destination_is_set: destination /= 0
selected_a_destination: destination_selected
select_empty_column: BOOLEAN
-- Selects an empty column if available
require
no_destination: not destination_selected
ensure
destination_selected_on_result: Result implies destination_selected
select_empty_xcell
-- Selects an empty xcell if available
require
no_destination: not destination_selected
select_source (x_pos, y_pos: INTEGER)
shuffle_the_cards (game_number: INTEGER)
-- Shuffle the cards with game_number
require
game_number_greater_than: game_number > 0
game_number_smaller_equal_than: game_number <= 65000
Space_between_cards: INTEGER is 28
-- Vertical space between the cards in a column
-- (from GAME_CONSTANTS)
Space_between_columns: INTEGER is 80
-- Horizontal space between the columns including the card width
-- (from GAME_CONSTANTS)
Start_of_column_y_position: INTEGER is 130
-- The minimal y_position of a column
-- (from GAME_CONSTANTS)
the_cards: ARRAY [CARD]
-- The cards in the game
White_offset: INTEGER is 40
-- White space surrounding picture at start
-- of the game
-- (from GAME_CONSTANTS)
Xcell_offset: INTEGER is 0
-- A xcell is identified in the movement by its number + 0
-- (from GAME_CONSTANTS)
feature -- Status report
active_card: CARD
-- Card that is currently selected
destination: INTEGER
-- The destination of the current movement
destination_selected: BOOLEAN
-- Is the destination selected?
previous_card: CARD
-- If the source is a column, this card will be the
-- card that is one from the top in the source column.
-- If the column has only one card or the source is
-- not a column, this card will be void.
source: INTEGER
-- The source of the current movement
source_is_column: BOOLEAN
-- Is the source a column?
source_selected: BOOLEAN
-- Is the source selected?
feature -- Element change
move_card: BOOLEAN
-- Can the active card be moved from
-- source to destination?
-- Result is True on movement.
require
source_is_valid: source_selected
destination_is_valid: destination_selected
invariant
game_not_void: game /= void
-- from ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
end -- class GAME_MANAGER
-- Generated by ISE Eiffel --
-- For more details: www.eiffel.com --