' Hitesh Yalamanchili

' Rocky Run Middle School

' Junior Division

' Contest 3, 2010-2011

' Mancala

' Program Written in BASIC

 

Dim as integer runnum, bowl(14), cnt, start, end1, cnt2

For cnt = 1 to 14

    bowl(cnt) = 4

Next cnt

Print "Please enter all five lines: "

For runnum = 1 to 5

    Input "", start, end1

    If start >= 7 and start <= 12 then start = start + 1

    If end1 >= 7 and end1 <= 12 then end1 = end1 + 1

    cnt2 = start + 1

    For cnt = bowl(start) to 1 step -1

        If (cnt2 = 14 and start < 7) or (cnt2 = 7 and start > 7) then cnt2 = cnt2 + 1

        If cnt2 > 14 then cnt2 = cnt2 mod 14

        bowl(cnt2) = bowl(cnt2) + 1

        cnt2 = cnt2 + 1

    Next cnt

    bowl(start) = 0

    Print bowl(end1)

Next runnum

sleep