Diferencia entre revisiones de «Ejemplo de un VPL Python»

De Documentación Campus Virtual de la UEx
Ir a la navegación Ir a la búsqueda
(Página creada con «== '''Ejemplo de un VPL Python''' == <div style="border-left:#FFA000 7px solid;border-top:#FFA000 1px solid;border-right:#FFA000 2px solid;border-bottom:2px #FFA000 solid;...»)
 
Sin resumen de edición
Línea 17: Línea 17:
<div class="editor-indent" style="margin-left: 30px;">
<div class="editor-indent" style="margin-left: 30px;">
     <div class="editor-indent" style="margin-left: 30px;">
     <div class="editor-indent" style="margin-left: 30px;">
         <p><span><span class="" style="font-weight: bold; color: rgb(184, 138, 0);">case = </span><span class="" style="color: rgb(151, 174, 45);"><b>Test 1</b></span></span>
         <p><span class="" style="font-weight: bold; color: rgb(184, 138, 0); font-size: small;">case = </span><span class="" style="color: rgb(151, 174, 45);"><b><span class="" style="font-size: small;">Test 1</span></b>
        </p>
            </span><br><b><span class="" style="color: rgb(191, 144, 249); font-size: small;">input =</span><span class="" style="color: rgb(151, 174, 45); font-size: small;"> 0</span></b><br><b><span class="" style="color: rgb(191, 144, 249); font-size: small;">output = </span><span><span class="" style="color: rgb(151, 174, 45); font-size: small;">"</span></span></b><br><b><span class="" style="color: rgb(151, 174, 45); font-size: small;">"</span></b><br><b><span class="" style="color: rgb(184, 138, 0); font-size: small;">case =</span><span class="" style="font-size: small;"> </span></b>
    </div>
            <span
    <div class="editor-indent" style="margin-left: 30px;">
                class="" style="color: rgb(151, 174, 45);"><b><span class="" style="font-size: small;">Test 2</span></b></span><br><b><span class="" style="color: rgb(191, 144, 249); font-size: small;">input =</span><span class="" style="color: rgb(191, 144, 249); font-size: small;">&nbsp;</span></b><b><span class="" style="color: rgb(151, 174, 45); font-size: small;">1</span></b><br>
        <p><b><span class="" style="color: rgb(191, 144, 249);">input =</span><span class="" style="color: rgb(151, 174, 45);"> 0</span></b></p>
                <span
    </div>
                    class="" style="color: rgb(191, 144, 249);"><b><span class="" style="font-size: small;">output =</span></b><span class="" style="font-size: small;"> </span></span><span class="" style="color: rgb(151, 174, 45); font-size: small;">"###</span><br><span style="color: rgb(151, 174, 45); font-size: small;"
    <div class="editor-indent" style="margin-left: 30px;">
                        class="">###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">"</span><br><b><span class="" style="color: rgb(184, 138, 0); font-size: small;">case =</span><span class="" style="font-size: small;"> </span></b>
        <p><b><span class="" style="color: rgb(191, 144, 249);">output = </span><span><span class="" style="color: rgb(151, 174, 45);">"</span></span></b></p>
                    <span
    </div>
                        class="" style="color: rgb(151, 174, 45);"><b><span class="" style="font-size: small;">Test 3</span></b></span><br><span class="" style="color: rgb(191, 144, 249);"><b><span class="" style="font-size: small;">input = </span></b>
    <div class="editor-indent" style="margin-left: 30px;">
                        </span><b><span class="" style="color: rgb(151, 174, 45); font-size: small;">8</span></b><span class="" style="font-size: small;">&nbsp;</span><br><b><span class="" style="color: rgb(191, 144, 249); font-size: small;">output = </span></b>
        <p><b><span class="" style="color: rgb(151, 174, 45);">"</span></b></p>
                        <span
    </div>
                            class="" style="color: rgb(151, 174, 45); font-size: small;">"###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br>
    <div class="editor-indent" style="margin-left: 30px;">
                            <span
        <p>&nbsp;</p>
                                style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br>
    </div>
                                <span
    <div class="editor-indent" style="margin-left: 30px;">
                                    style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br>
        <p><b><span class="" style="color: rgb(184, 138, 0);">case =</span> </b><span class="" style="color: rgb(151, 174, 45);"><b>Test 2</b></span></p>
                                    <span
    </div>
                                        style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br>
    <div class="editor-indent" style="margin-left: 30px;">
                                        <span
        <p><b><span class="" style="color: rgb(191, 144, 249);">input =</span><span class="" style="color: rgb(191, 144, 249);">&nbsp;</span></b><b><span class="" style="color: rgb(151, 174, 45);">1</span></b></p>
                                            style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br>
    </div>
                                            <span
    <div class="editor-indent" style="margin-left: 30px;">
                                                style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br>
        <p><span class="" style="color: rgb(191, 144, 249);"><b>output =</b> </span><span class="" style="color: rgb(151, 174, 45);">"###</span></p>
                                                <span
    </div>
                                                    style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">###...###...###...###...</span><br>
    <div class="editor-indent" style="margin-left: 30px;">
                                                    <span
        <p><span class="" style="color: rgb(151, 174, 45);">###</span></p>
                                                        style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br><span style="color: rgb(151, 174, 45); font-size: small;" class="">...###...###...###...###</span><br></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">"</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><b><span class="" style="color: rgb(184, 138, 0);">case =</span> </b><span class="" style="color: rgb(151, 174, 45);"><b>Test 3</b></span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(191, 144, 249);"><b>input = </b></span><b><span class="" style="color: rgb(151, 174, 45);">8</span></b>&nbsp;</p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><b><span class="" style="color: rgb(191, 144, 249);">output = </span></b><span class="" style="color: rgb(151, 174, 45);">"###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">###...###...###...###...</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
    </div>
    <div class="editor-indent" style="margin-left: 30px;">
        <p><span class="" style="color: rgb(151, 174, 45);">...###...###...###...###</span></p>
     </div>
     </div>
</div>
</div>
<p style="text-align: center;"><br></p>


<div style="text-align:center;">[[Archivo:CasosPrueba_VPLPython.PNG|650px]]</div>
<div style="text-align:center;">[[Archivo:CasosPrueba_VPLPython.PNG|650px]]</div>


=== '''Opciones de ejecución''': ===
=== '''Opciones de ejecución''': ===
::Se detectará la extensión del fichero entregado, así que no seleccionamos ningún '''SCRIPT''' ni para ejecutar ni para depurar, se detectará automáticamente.
::Se detectará la extensión  
:: En nuestro ejemplo, no activamos las opciones de "''Ejecutar''" ni "''Evaluar''", ya que no se van a hacer entregas.
<div style="text-align:center;">[[Archivo:OpEjecucion_VPLPython.PNG|650px]]</div>
<div style="text-align:center;">[[Archivo:OpEjecucion_VPLOctave.PNG|650px]]</div>


=== '''Ficheros requeridos''': ===
=== '''Ficheros requeridos''': ===
Línea 143: Línea 56:
::En este caso, '''''funcion.m''''' es el único fichero que necesitamos, único fichero requerido.
::En este caso, '''''funcion.m''''' es el único fichero que necesitamos, único fichero requerido.


::'''funcion.m''':
::''%%Ejemplo multiplicación de matrices''
::''%%evaluación automática''
::::''A=[4 8;3 5];''
::::''B=[9,2;1,6];''
::::''%disp(A);''
::::''%disp(B);''
::::''disp(A*B);''
::''%%Representación gráfica función senoidal entre -10 y 10''
::::''x = -10:0.1:10;''
::::''plot (x, sin (x));''
::::''xlabel ("x");''
::::''ylabel ("sin (x)");''
::::''title ("Simple 2-D Plot");''




<div style="text-align:center;">[[Archivo:FichRequeridos_VPLOctave.PNG|650px]]</div>
<div style="text-align:right;">[[Archivo:FichRequeridos_VPLPython.PNG|650px]]</div>


=== '''Ajustes avanzados''': ===
=== '''Ajustes avanzados''': ===
Línea 166: Línea 64:
::::Se establecen los ficheros necesarios para la ejecución, depurado o evaluación de la entrega. Esto incluye ficheros script, programas de prueba y ficheros de datos.
::::Se establecen los ficheros necesarios para la ejecución, depurado o evaluación de la entrega. Esto incluye ficheros script, programas de prueba y ficheros de datos.
::::En nuestro ejemplo, no tenemos fichero para ejecutar la entrega ya que sólo necesitamos los ficheros scripts que ya autodetecta el laboratorio en función de la extensión de nuestra entrega (''funcion.m''), así que sólo tenemos contenido en el fichero de evaluación de casos, con un único test de ejemplo:
::::En nuestro ejemplo, no tenemos fichero para ejecutar la entrega ya que sólo necesitamos los ficheros scripts que ya autodetecta el laboratorio en función de la extensión de nuestra entrega (''funcion.m''), así que sólo tenemos contenido en el fichero de evaluación de casos, con un único test de ejemplo:
<div style="text-align:center;">[[Archivo:FichEjecucion_VPLOctave.PNG|650px]]</div>
<div style="text-align:center;">[[Archivo:FichEjecucion_VPLPython.PNG|650px]]</div>
<p style="text-align: left;">&nbsp; &nbsp; &nbsp;&nbsp;<span class="" style="font-size: medium; font-family: Verdana, Geneva, sans-serif;"><i>Al tratarse de un ejemplo de ejecución de un VPL, lo hemos configurado <b>sin entregas ni ejecución o evaluación automática</b>, así que el resto de opciones del Laboratorio no necesitamos configurarlas para hacer la prueba:</i></span></p>
<p style="text-align: left;">&nbsp; &nbsp; &nbsp;&nbsp;<span class="" style="font-size: medium; font-family: Verdana, Geneva, sans-serif;"><i> no necesitamos configurarlas para hacer la prueba:</i></span></p>
::* '''Límites máximos de recursos de ejecución''' (NO NECESITA CONFIGURACIÓN)
::* '''Límites máximos de recursos de ejecución'''  
::* '''Ficheros a mantener mientras se ejecuta''' (NO NECESITA CONFIGURACIÓN)
::* '''Ficheros a mantener mientras se ejecuta'''  
::* '''Variaciones''' (NO NECESITA CONFIGURACIÓN)
::* '''Variaciones'''  
::* '''Comprobación de servidores de ejecución''' (NO NECESITA CONFIGURACIÓN)
::* '''Comprobación de servidores de ejecución'''  
::* '''Servidores de ejecución locales''' (NO NECESITA CONFIGURACIÓN)
::* '''Servidores de ejecución locales'''  


=== '''Probar actividad''': ===
=== '''Probar actividad''': ===

Revisión del 08:05 15 dic 2020

Ejemplo de un VPL Python

Vamos a crear un Laboratorio Virtual de Programación Python:
Ejemplo de cómo realizar un laboratorio que evalúa la práctica del alumno con varios casos de uso establecidos que simulan la introducción del parámetro de entrada por el usuario.. 
En este caso se evalúa la entrega realizada por un alumno, en la que se debe representar un tablero de ajedrez con las dimensiones que se indique por consola.
        

Configuración:

En un principio, como en la creación de todas las actividades de VPL, estas serían las únicas opciones de configuración del laboratorio: Nombre y "Descripción del Laboratorio"
Configuracion VPLPython.PNG

Casos de prueba:

Para este laboratorio se han implementado 3 tests de pruebas, y el fichero vpl_evaluate.cases será:

case = Test 1
input = 0
output = "
"
case = Test 2
input = 1
output = "###
###
###
"
case = Test 3
input = 8 
output = "###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###
###...###...###...###...
###...###...###...###...
###...###...###...###...
...###...###...###...###
...###...###...###...###
...###...###...###...###

CasosPrueba VPLPython.PNG

Opciones de ejecución:

Se detectará la extensión
OpEjecucion VPLPython.PNG

Ficheros requeridos:

Nuestro fichero se llama funcion.m, y como hemos visto en la tabla, la extensión m es la que tienen los ficheros Matlab/Octave, y que VPL autodetectará para ejecutar el script correspondiente.
En este caso, funcion.m es el único fichero que necesitamos, único fichero requerido.


FichRequeridos VPLPython.PNG

Ajustes avanzados:

  • Ficheros para la ejecución
Se establecen los ficheros necesarios para la ejecución, depurado o evaluación de la entrega. Esto incluye ficheros script, programas de prueba y ficheros de datos.
En nuestro ejemplo, no tenemos fichero para ejecutar la entrega ya que sólo necesitamos los ficheros scripts que ya autodetecta el laboratorio en función de la extensión de nuestra entrega (funcion.m), así que sólo tenemos contenido en el fichero de evaluación de casos, con un único test de ejemplo:
FichEjecucion VPLPython.PNG

       no necesitamos configurarlas para hacer la prueba:

  • Límites máximos de recursos de ejecución
  • Ficheros a mantener mientras se ejecuta
  • Variaciones
  • Comprobación de servidores de ejecución
  • Servidores de ejecución locales

Probar actividad: