index_in_cards Function

function index_in_cards(c, with_jokers)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: c
logical, intent(in) :: with_jokers

if considering jokers

Return Value integer


Called by

proc~~index_in_cards~~CalledByGraph proc~index_in_cards problem_7::index_in_cards proc~beats problem_7::beats proc~beats->proc~index_in_cards program~problem_7 problem_7 program~problem_7->proc~beats

Source Code

    integer function index_in_cards(c,with_jokers)
        character(len=1),intent(in) :: c
        logical,intent(in) :: with_jokers !! if considering jokers
        integer :: i
        do i = 1, size(cards_with_joker)
            if (with_jokers) then
                if (c == cards_with_joker(i)) then
                    index_in_cards = i
                    return
                end if
            else
                if (c == cards(i)) then
                    index_in_cards = i
                    return
                end if
            end if
        end do
        error stop 'card not found'
    end function index_in_cards