Show
Ignore:
Timestamp:
07/28/09 03:49:09 (4 months ago)
Author:
sukyoungryu
Message:

[demos] Hopefully fixed two failing demos. demos/wordcount2.fss is still failing.

Location:
trunk/ProjectFortress/demos
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/demos/newtictactoe.fss

    r3910 r4015  
    144144            try 
    145145                println "Your turn, " name 
    146                 yourMove = strToInt(readLine()) 
    147                 newBoard = board.move(yourMove, playerOne) 
    148                 if newBoard.isGameOver() then 
    149                     announceGameEnd(newBoard) 
     146                line = readLine() 
     147                if (|line| = 0) 
     148                then 
     149                    println "Invalid response." 
     150                    exit quit with false 
    150151                else 
    151                     myMove = smartAi(newBoard) 
    152                     println "I play " myMove 
    153                     play(newBoard.move(myMove, playerTwo)) 
     152                    yourMove = strToInt(line) 
     153                    newBoard = board.move(yourMove, playerOne) 
     154                    if newBoard.isGameOver() then 
     155                        announceGameEnd(newBoard) 
     156                    else 
     157                        myMove = smartAi(newBoard) 
     158                        println "I play " myMove 
     159                        play(newBoard.move(myMove, playerTwo)) 
     160                    end 
    154161                end 
    155162            catch e 
     
    157164                    println "You cannot move there. Choose again." 
    158165                    play(board) 
    159                 end 
    160                 IndexOutOfBounds[\ZZ32\] => do 
    161                     println "Invalid response." 
    162                     exit quit with false 
    163166                end 
    164167            end 
     
    191194    name = readLine() 
    192195    println "What size board?" 
    193     try 
    194         N = strToInt(readLine()) 
     196    line = readLine() 
     197    if (|line| = 0) 
     198    then 
     199        println "Invalid response." 
     200    else 
     201        N = strToInt(line) 
    195202        while playGame(name, N) do 
    196203            println "" 
    197204        end 
    198     catch e 
    199         IndexOutOfBounds[\ZZ32\] => 
    200             println "Invalid response." 
    201205    end 
    202206    println "Bye!" 
  • trunk/ProjectFortress/demos/tictactoe.fss

    r3645 r4015  
    241241                println board 
    242242                println "Your turn " name 
    243                 pos = strToInt(readLine()) 
    244                 play(smartAi(board.move(pos, 1))) 
     243                line = readLine() 
     244                if (|line| = 0) 
     245                then 
     246                    println "Invalid response." 
     247                    exit quit with false 
     248                else 
     249                    pos = strToInt(line) 
     250                    play(smartAi(board.move(pos, 1))) 
     251                end 
    245252            catch e 
    246253                IllegalMove => do 
    247254                    println "You cannot move there. Choose again." 
    248255                    play(board) 
    249                 end 
    250                 IndexOutOfBounds[\ZZ32\] => do 
    251                     println "Invalid response." 
    252                     exit quit with false 
    253256                end 
    254257            end