Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with an Othello (AKA Reversi) Game
#3
*whipes his eyes while they remain open...did I just see Z!re throw a kiss?* This has nothing to do with with "Kiss of the spider woman" does it? ;-). lol

I have to agree with Z!re here, well formatted code Smile please to look at.

I suspect it enters the Out Of Stack space when your program enters this particular while loop:

Code:
IF NOT (CurColumn - 1 AND CurRow - 1) THEN
                                                        UpTo = -1
                                                        WHILE UpTo < FlipperM(CurRow + 2, CurColumn + 2)
                                                                UpTo = UpTo + 1
                                                                DIM Mx AS INTEGER
                                                                DIM My AS INTEGER
                                                                Mx = ARow + CurRow * UpTo
                                                                My = AColumn + CurColumn * UpTo
                                                                IF Board(Mx, My) <> PColor THEN
                                                                        Board(Mx, My) = PColor
                                                                END IF
                                                        WEND

Reason is simple, I think this is nested in too deep in stacks (all the DO, while, FOR, IF before you get to the if are stack levels, you're probably simple reaching the stack limit when you get to that WHILE up there.

Perhaps you should see if you couldn't maybe break this down into less stack levels (maybe some of those ifs could be grouped and done before then based on certain variables set in those ifs you could then decide which loop you need to execute, this way, all those ifs and dos and whiles wouldn't be within each other and hence less stack space would be used. :-).

COnsequently, doing this will probably solve your Out Of Memory error as well when editing the code.

If you're using VB-DOS or QB P.D.S. 7.1 you can lookup the STACK statement which allows you to reserve more stack space.

As for the AI part, I'm not a big pro at Othello, can you give some examples of illegal moves it sometimes makes? Then I could cross reference the logic for ya and pinpoint it :-).
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply


Messages In This Thread
Help with an Othello (AKA Reversi) Game - by Z!re - 08-03-2005, 03:39 AM
Help with an Othello (AKA Reversi) Game - by MystikShadows - 08-03-2005, 06:14 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)