Que documento

Solo disponible en BuenasTareas
  • Páginas : 8 (1780 palabras )
  • Descarga(s) : 0
  • Publicado : 26 de enero de 2011
Leer documento completo
Vista previa del texto
program TicTacToe (input, output); |
002 | label |

003 |      begingame, picknumber, checkmove, checkforwin, compmove, winner, nobodywon, playagain, illegalmove, compcrash, endgame; |
004 | var |

005 |    playmove, turn, points : integer; |
006 |    place1, place2, place3, place4, place5, place6, place7, place8, place9 : char; |

007 |    currentplayer, ynagain, lastwinner: char; |
008 | begin |

009 |      writeln; |
010 |      writeln('JRSs Tic-Tac-Toe v1.1'); |

011 |      writeln('Created by James Skemp - http://jamesrskemp.net/');{2003.11.09} |
012 |      writeln('Version 1.0: 2003.11.09'); |

013 |      writeln('Version 1.1: 2003.11.09'); |
014 |      writeln; |

015 |      points := 0; |
016 |      lastwinner := 'J'; |

017 |     begingame: |
018 |      turn := 0; |

019 |      place1 := '1'; |
020 |      place2 := '2'; |

021 |      place3 := '3'; |
022 |      place4 := '4'; |

023 |      place5 := '5'; |
024 |      place6 := '6'; |

025 |      place7 := '7'; |
026 |      place8 := '8'; |

027 |      place9 := '9'; |
028 |      if (lastwinner = 'J') then goto picknumber; |

029 |      if (lastwinner= 'X') then goto compmove; |
030 |      if ((lastwinner = 'O') and (points <10)) then goto picknumber; |

031 |      if ((lastwinner = 'O') and (points >11)) then goto compmove; |
032 |      picknumber: |

     currentplayer := 'X'; |
     writeln; |

     writeln; |
     writeln('     |   |   '); |

037 |      writeln('   ',place1,' | ',place2,' | ',place3,' '); |
038 |     writeln('     |   |   '); |

039 |      writeln('  ---+---+---'); |
040 |      writeln('     |   |   '); |

|      writeln('   ',place4,' | ',place5,' | ',place6,' '); |
|      writeln('     |   |   '); |

|    writeln('  ---+---+---'); |
044 |      writeln('     |   |   '); |

045 |      writeln('   ',place7,' | ',place8,' | ',place9,' '); |
046 |      writeln('     |   |   '); |047 |      writeln; |
048 |      writeln('Pick a number that you would like to take (you are ''X''). '); |

049 |      readln(playmove); |
050 |      checkmove: |

051 |      if ((playmove > 9) and (playmove <> 33)) or (playmove < 1) then |
052 |       begin |

053 |        writeln('Whoops.  That''s an illegal move, try again.'); |
054 |        writeln; |

055|        goto picknumber; |
056 |       end; |

057 |      if (playmove = 1) and (place1 = '1') then |
058 |       begin |

059 |        place1 := 'X'; |
060 |        goto checkforwin; |

061 |       end; |
062 |      if (playmove = 2) and (place2 = '2') then |

063 |       begin |
064 |        place2 := 'X'; |

065 |        goto checkforwin; |
066 |       end; |

067|      if (playmove = 3) and (place3 = '3') then |
068 |       begin |

069 |        place3 := 'X'; |
070 |        goto checkforwin; |

071 |       end; |
072 |      if (playmove = 4) and (place4 = '4') then |

073 |       begin |
074 |        place4 := 'X'; |

075 |        goto checkforwin; |
076 |       end; |

077 |      if (playmove = 5) and (place5 = '5') then |078 |       begin |

079 |        place5 := 'X'; |
080 |        goto checkforwin; |

081 |       end; |
082 |      if (playmove = 6) and (place6 = '6') then |

083 |       begin |
084 |        place6 := 'X'; |

085 |        goto checkforwin; |
086 |       end; |

087 |      if (playmove = 7) and (place7 = '7') then |
088 |       begin |

089 |        place7 := 'X'; |090 |        goto checkforwin; |

091 |       end; |
092 |      if (playmove = 8) and (place8 = '8') then |

093 |       begin |
094 |        place8 := 'X'; |

095 |        goto checkforwin; |
096 |       end; |

097 |      if (playmove = 9) and (place9 = '9') then |
098 |       begin |

099 |        place9 := 'X'; |
100 |        goto checkforwin; |

101 |...
tracking img