{"id":4494,"date":"2014-03-21T08:55:34","date_gmt":"2014-03-21T13:55:34","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/icm00794\/?p=4494"},"modified":"2026-10-14T06:43:39","modified_gmt":"2026-10-14T11:43:39","slug":"s1eva2011tii_t3-parchis-2-fichas","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-s1eva20\/s1eva2011tii_t3-parchis-2-fichas\/","title":{"rendered":"s1Eva2011TII_T3 Parchis 2 fichas"},"content":{"rendered":"\n<p><em><strong>Ejercicio<\/strong><\/em>: <a href=\"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-1eva20\/1eva2011tii_t3-parchis-2-fichas\/\" data-type=\"post\" data-id=\"3232\">1Eva2011TII_T3 Parchis 2 fichas<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"547\" height=\"444\" src=\"http:\/\/blog.espol.edu.ec\/algoritmos101\/files\/2014\/03\/tablero_parchisficha01.png\" alt=\"tablero parchis ficha\" class=\"wp-image-16547\" style=\"width:350px\" \/><\/figure>\n\n\n\n<p>Por simplicidad, inicie solo con un jugador. <\/p>\n\n\n\n<figure class=\"wp-block-table alignright\"><table><tbody><tr><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><th>7<\/th><th>8<\/th><th>9<\/th><th>...<\/th><\/tr><tr><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><th>6<\/th><td>&nbsp;<\/td><td>&nbsp;<\/td><th>...<\/th><\/tr><tr><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><th>5<\/th><td>&nbsp;<\/td><td>&nbsp;<\/td><th>49<\/th><\/tr><tr><th>Partida<\/th><th>1<\/th><th>2<\/th><th>3<\/th><th>4<\/th><td>&nbsp;<\/td><td>&nbsp;<\/td><th>50<\/th><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>La posici\u00f3n en el tablero se registra en la variable <strong>a<\/strong>. La meta se alcanza en la casilla 50.<\/p>\n\n\n\n<p>Lanza el un dado para el primer jugador y avanza la posici\u00f3n tantas veces sea necesario hasta que llegue a la meta.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a=0\ndado = <span style=\"color: #ff00ff\">int<\/span>(rnd.random()*6)+1\na = a + dado<\/code><\/pre>\n\n\n\n<p>Luego incorpore al segundo jugador y observe las posiciones de cada uno hasta que llegue uno de ellos a la meta para seleccionar al ganador.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Algoritmo en Python<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# ICM00794-Fundamentos de Computaci\u00f3n - FCNM-ESPOL\n# 1Eva_IIT2011_T3 Parchis 2 fichas\n# Tarea: implementar la selecci\u00f3n de inicio\nimport random as rnd\n\n# INGRESO\nmeta = 50\n\n# PROCEDIMIENTO\na=0\nb=0\nwhile not(a&gt;=meta or b&gt;=meta):\n\n    dado = int(rnd.random()*6)+1\n    a = a + dado\n    if (a==b):\n        b = 0\n\n    dado = int(rnd.random()*6)+1\n    b = b + dado\n    if (b==a):\n        a = 0\n\nif (a&gt;=50):\n    gana = 1\nelse:\n    gana = 2\n\n# SALIDA\nprint('ganador: ')\nprint(gana)\n<\/pre><\/div>\n\n\n<p><strong>Tarea<\/strong>: Desarrolle una versi\u00f3n para los 4 jugadores de Parch\u00eds.<br>Luego en otra versi\u00f3n, considere usar las 4 fichas para cada jugador.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ejercicio: 1Eva2011TII_T3 Parchis 2 fichas Por simplicidad, inicie solo con un jugador. &nbsp; &nbsp; &nbsp; &nbsp; 7 8 9 ... &nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; &nbsp; ... &nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp; 49 Partida 1 2 3 4 &nbsp; &nbsp; 50 La posici\u00f3n en el tablero se registra en la variable a. [&hellip;]<\/p>\n","protected":false},"author":8043,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"wp-custom-template-entrada-fp-ejemplos","format":"standard","meta":{"footnotes":""},"categories":[130],"tags":[58,157],"class_list":["post-4494","post","type-post","status-publish","format-standard","hentry","category-fp-s1eva20","tag-ejemplos-python","tag-fundamentos-programacion"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/4494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/users\/8043"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/comments?post=4494"}],"version-history":[{"count":7,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/4494\/revisions"}],"predecessor-version":[{"id":26311,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/4494\/revisions\/26311"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/media?parent=4494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/categories?post=4494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/tags?post=4494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}