Forum Discussion

ankitgaur's avatar
ankitgaur
Visitor
9 years ago

Execution timeout (runtime error &h23)

Right now I am working on an app, "Match 4" game which mimics the famous connect 4 game.

The problem we are facing is that the AI is build on MTD algorithm and code is perfectly tested. Its just sometimes machine gives, Execution timeout (runtime error &h23) while calculating best move.

Is there any way we can increase this time by some code? Please revert asap for some insight.

6 Replies

  • Eh? What language are you writing in? What SDK?
    Copy & paste the exact diagnostic from the console. Also which telnet port.
  • Hey,

    Thanks for reverting back.

    I am writing my application in BrightScript. I am developing a Scene Graph application and error is on port 8089.
    My machine software version is: 7.2.0
    Build: 4100

    It gives error.

    Here is the error that prints:

    Current Function:
    860: sx = m.width - 1 - GetMax(cx - 2, 0)
    861: sy = Abs(GetMin(cx - 2, 0))
    862: winning = []
    863: for cy = 0 to m.height - 1
    864: x = sx - cy
    865: y = sy + cy
    866: if x < 0 OR y < 0 OR x >= m.width OR y >= m.height
    867:
    868:* else if boardArray[x,y] = player OR boardArray[x,y] = m.empty
    869: push = []
    870: push[0] = x
    871: push[1] = y
    872: winning.push(push)
    Execution timeout (runtime error &h23) in pkg:/components/Connect4.brs(868)
    868: else if boardArray[x,y] = player OR boardArray[x,y] = m.empty
    Backtrace:
    #12 Function winlines(boardarray As Object, player As String) As Object
    file/line: pkg:/components/Connect4.brs(868)
    #11 Function heuristicscore(boardarray As Object, player As String) As Integer
    file/line: pkg:/components/Connect4.brs(745)
    #10 Function heuristic(boardarray As Object) As Integer
    file/line: pkg:/components/Connect4.brs(741)
    #9 Function minimax(boardarray As Object, player As Boolean, depth As Integer,
    alpha As Integer, beta As Integer) As Object
    file/line: pkg:/components/Connect4.brs(571)
    #8 Function minimax(boardarray As Object, player As Boolean, depth As Integer,
    alpha As Integer, beta As Integer) As Object
    file/line: pkg:/components/Connect4.brs(582)
    #7 Function minimax(boardarray As Object, player As Boolean, depth As Integer,
    alpha As Integer, beta As Integer) As Object
    file/line: pkg:/components/Connect4.brs(600)
    #6 Function minimax(boardarray As Object, player As Boolean, depth As Integer,
    alpha As Integer, beta As Integer) As Object
    file/line: pkg:/components/Connect4.brs(582)
    #5 Function mtd(g As Object, d As Integer) As Object
    file/line: pkg:/components/Connect4.brs(509)
    #4 Function iterativedeepening(think As Integer) As Object
    file/line: pkg:/components/Connect4.brs(482)
    #3 Function best() As Integer
    file/line: pkg:/components/Connect4.brs(466)
    #2 Function do_computer_new() As Void
    file/line: pkg:/components/Connect4.brs(1011)
    #1 Function user_move() As Void
    file/line: pkg:/components/Connect4.brs(1144)
    #0 Function onkeyevent(key As String, press As Boolean) As Boolean
    file/line: pkg:/components/Connect4.brs(295)
  • Hey,

    Yes , the code does not break always and the error you are seeing does not come at the spot where its showing always, it deviates anywhere the execution time is out.

    Plus the empty space in if condition is in order to mimic CONTINUE operation for FOR loop.

    Eg. if condition is true skip the iteration, but as there is no CONTINUE in brightscript, hence empty IF.
  • RokuKC's avatar
    RokuKC
    Roku Employee
    "ankitgaur" wrote:
    Right now I am working on an app, "Match 4" game which mimics the famous connect 4 game.

    The problem we are facing is that the AI is build on MTD algorithm and code is perfectly tested. Its just sometimes machine gives, Execution timeout (runtime error &h23) while calculating best move.

    Is there any way we can increase this time by some code? Please revert asap for some insight.


    If you are writing a Scene Graph UI, best practice is to run any non-trivial calculations (such as game AI) on a task thread, and not in the render thread.
    Otherwise the UI will not be responsive to the user.

    https://sdkdocs.roku.com/display/sdkdoc ... ph+Threads