disks.hpp
// Algorithm that sorts disks using the left-to-right algorithm.

Algorithm that sorts disks using the left-to-right algorithm.
Algorithm that sorts disks using the left - to - right algorithm .
sorted_disks sort_left_to_right(const disk_state& before) 
{
    int count = 0;
    disk_state newState = before;
    if (newState.is_alternating())
    {
        for (int index = 0; index < newState.total_count() - 1; index++) 
        {
            for (int j = index; j < newState.total_count() - 1; j++) 
            {
                if ((newState.get(j) == DISK_DARK) && (newState.get(j + 1) == DISK_LIGHT))
                {
                    newState.swap(j);
                    count++;
                }
            }
        }
    }
    return sorted_disks(newState, count);
}
sorted_disks sort_left_to_right ( const disk_state & before ) { int count = 0 ; disk_state newState = before ; if ( newState . is_alternating ( ) ) { for ( int index = 0 ; index < newState . total_count ( ) - 1 ; index ++ ) { for ( int j = index ; j < newState . total_count ( ) - 1 ; j ++ ) { if ( ( newState . get ( j ) == DISK_DARK ) && ( newState . get ( j + 1 ) == DISK_LIGHT ) ) { newState . swap ( j ) ; count ++ ; } } } } return sorted_disks ( newState , count ) ; }
Algorithm that sorts disks using the left-to-right algorithm.
Algorithm that sorts disks using the left - to - right algorithm .
//counter variable
