You are not logged in or registered. Please login or register to use the full functionality of this board...
The QB64 Edition
Overboard Board Game in QB64 - Printable Version

+- The QB64 Edition (http://www.thejoyfulprogrammer.com/qb64/forum)
+-- Forum: QB64 (/forumdisplay.php?fid=483)
+--- Forum: QB64 Coders Delight (/forumdisplay.php?fid=8)
+---- Forum: Video Games of the Programming Guru's (/forumdisplay.php?fid=445)
+----- Forum: Donald Foster (/forumdisplay.php?fid=449)
+------ Forum: Donald Foster's games (/forumdisplay.php?fid=461)
+------ Thread: Overboard Board Game in QB64 (/showthread.php?tid=130)



Overboard Board Game in QB64 - Donald Foster - 08-13-2014 12:00 AM

Hello everyone,

I've completed another board game. Overboard was originally written 30 years ago on the TRS-80 Model 4 and rewritten over 25 years ago on the Model 2000.

Object of the game: To be the first player to push all of your opponent's overboard.

Controls: Letters and Numbers to select board location. BACKSPACE to de-select move. ENTER to complete move.

Hope you enjoy playing.

Donald


Code Snippet: [Select]
_TITLE "Overboard by Donald L. Foster Jr."


SCREEN _NEWIMAGE(1010, 735, 256)

_LIMIT 100

_PALETTECOLOR 1, _RGB32(120, 120, 120) ' Lt Grey
_PALETTECOLOR 3, _RGB32(90, 90, 90) '    Med Grey
_PALETTECOLOR 5, _RGB32(60, 60, 60) '    Dk Grey
_PALETTECOLOR 2, _RGB32(1, 1, 1) '       Lt Black

DIM X1(60, 60), T(70), L(10004), M1(147), M2(147), M3(147), M4(147), M5(147), M6(147), MA(147), MB(147), MC(147), MD(147), ME(147), MF(147)

N$ = "D82R81G18L81U82E18"
L$(1) = "": L$(2) = "": L$(3) = "": L$(4) = "": L$(5) = "": L$(6) = ""

DEFINT P
D(1) = 15: D(2) = 4
I(1) = 18: I(2) = 18
FOR Z = 1 TO 6: T(64 + Z) = Z: NEXT
A = 1: C = 2

DATA 1,1,2,1,1,2,2,2,1,1,1,2,2,2,1,2,2,1,1,2,2,1,2,2,2,1,1,1,2,2,2,1,1,2,1,1
DATA 1,2,2,1,1,2,2,1,2,1,2,1,2,2,1,2,2,1,1,1,1,2,1,2,2,1,2,1,2,1,2,2,1,2,2,1
DATA 2,1,1,2,2,1,1,1,2,1,2,2,1,2,2,1,1,2,2,1,1,2,2,1,2,2,1,2,1,1,1,2,2,1,1,2
DATA 1,1,2,1,2,2,1,2,2,1,1,2,2,2,1,2,1,1,1,1,2,1,2,2,2,1,1,2,2,1,2,2,1,2,1,1

FOR Z = 1 TO 4: FOR Y = 1 TO 6: FOR X = 1 TO 6: READ C(Z, Y, X): NEXT: NEXT: NEXT

LOCATE 1, 2: PRINT "1 2 3 4 5 6 A B C D E F"
GET (6, 0)-(17, 13), M1()
GET (22, 0)-(33, 13), M2()
GET (38, 0)-(49, 13), M3()
GET (54, 0)-(65, 13), M4()
GET (70, 0)-(81, 13), M5()
GET (86, 0)-(97, 13), M6()
GET (102, 0)-(113, 13), MA()
GET (118, 0)-(129, 13), MB()
GET (134, 0)-(145, 13), MC()
GET (150, 0)-(161, 13), MD()
GET (166, 0)-(177, 13), ME()
GET (182, 0)-(193, 13), MF()

CLS
LOCATE 3, 48: PRINT "O   V   E   R   B   O   A   R   D";

V = 0
FOR Z = 1 TO 6
    X = 0
    FOR Y = 1 TO 6
        CIRCLE (152 + X, 250 + V), 10, D(C(1, Z, Y)): PAINT (152 + X, 250 + V), D(C(1, Z, Y))
        CIRCLE (350 + X, 250 + V), 10, D(C(2, Z, Y)): PAINT (350 + X, 250 + V), D(C(2, Z, Y))
        CIRCLE (538 + X, 250 + V), 10, D(C(3, Z, Y)): PAINT (538 + X, 250 + V), D(C(3, Z, Y))
        CIRCLE (734 + X, 250 + V), 10, D(C(4, Z, Y)): PAINT (734 + X, 250 + V), D(C(4, Z, Y))
        X = X + 25
    NEXT
    V = V + 25
NEXT

LOCATE 30, 45: PRINT "ENTER GAME SELECTION HERE. (1 TO 4) [_]";

GetGameSelection:
A$ = INKEY$
IF A$ = "" THEN GOTO GetGameSelection
IF (VAL(A$) > 0) * (VAL(A$) < 5) THEN B = VAL(A$): LOCATE 30, 82: PRINT A$;: GOTO GetGameSelection
IF ASC(A$) = 8 THEN B = 0: LOCATE 30, 82: PRINT "_";: GOTO GetGameSelection
IF ASC(A$) <> 13 THEN GOTO GetGameSelection

IF B = 0 THEN GOTO GetGameSelection

CLS
PUT (125, 3), M1()
PUT (227, 3), M2()
PUT (328, 3), M3()
PUT (429, 3), M4()
PUT (530, 3), M5()
PUT (631, 3), M6()
PUT (5, 107), MA()
PUT (5, 208), MB()
PUT (5, 309), MC()
PUT (5, 410), MD()
PUT (5, 511), ME()
PUT (5, 612), MF()

X = 0
FOR Z = 1 TO 7
    V = 0
    FOR Y = 1 TO 7
        LINE (40 + V, 20 + X)-(121 + V, 101 + X), 1, BF
        PSET (39 + V, 20 + X), 3: DRAW N$
        PAINT (37 + V, 25 + X), 3
        V = V + 101
    NEXT
    X = X + 101
NEXT

X = 0
FOR Z = 1 TO 6
    V = 0
    FOR Y = 1 TO 6
        CIRCLE (131 + V, 111 + X), 50, 2: PAINT (131 + V, 111 + X), D(C(B, Z, Y)), 2: CIRCLE (131 + V, 111 + X), 25, 2
        A(Z, Y) = 131 + V: B(Z, Y) = 111 + X
        V = V + 101
    NEXT
    X = X + 101
NEXT

X = 0
FOR Z = 1 TO 2
    V = 0
    FOR Y = 1 TO 2
        LINE (790 + V, 20 + X)-(871 + V, 101 + X), 1, BF
        PSET (789 + V, 20 + X), 3: DRAW N$
        PAINT (787 + V, 25 + X), 3
        V = V + 101
    NEXT
    X = X + 101
NEXT

GET (831, 61)-(931, 161), L()

LOCATE 44, 98: PRINT "O  V  E  R  B  O  A  R  D";

LOCATE 16, 107: PRINT "PLAYER";

LOCATE 21, 103: PRINT "S C O R E S";
LOCATE 24, 102: PRINT "PLAYER 1:";
LOCATE 26, 102: PRINT "PLAYER 2:";

STARTGAME:
PUT (831, 61), L(), PSET

CIRCLE (881, 111), 50, 2: PAINT (881, 111), D(A), 2: CIRCLE (881, 111), 25, 2

LOCATE 16, 114: PRINT A;
LOCATE 24, 112: PRINT I(1);
LOCATE 26, 112: PRINT I(2);

LOCATE 34, 98: PRINT "ENTER YOUR MOVE PATTERN.";
LOCATE 36, 101: PRINT "FROM [_ ] TO [  ].";

GETINPUT1:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT1
IF (ASC(A$) < 65) + (ASC(A$) > 70) THEN GOTO GETINPUT1
E = T(ASC(A$))

FOR Z = 1 TO 6: V1(Z) = 0: V2(Z) = 0: V3(Z) = 0: V4(Z) = 0: S1(Z) = 0: S2(Z) = 0: S3(Z) = 0: S4(Z) = 0: NEXT

FOR Z = 1 TO 6
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (E - 1 < 1) THEN GOTO LINE210
    IF C(B, E - 1, Z) = 0 THEN S1(Z) = 1
    T = 0: U = 0
    FOR Y = E - 1 TO 1 STEP -1
        IF C(B, Y, Z) = C THEN T = 1 ELSE IF C(B, Y, Z) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V1(Z) = 1

    LINE210:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (E + 1 > 6) THEN GOTO LINE240
    IF C(B, E + 1, Z) = 0 THEN S2(Z) = 1
    T = 0: U = 0
    FOR Y = E + 1 TO 6
        IF C(B, Y, Z) = C THEN T = 1 ELSE IF C(B, Y, Z) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V2(Z) = 1

    LINE240:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (Z - 1 < 1) THEN GOTO LINE270
    IF C(B, E, Z - 1) = 0 THEN S3(Z) = 1
    T = 0: U = 0
    FOR Y = Z - 1 TO 1 STEP -1
        IF C(B, E, Y) = C THEN T = 1 ELSE IF C(B, E, Y) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V3(Z) = 1

    LINE270:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (Z + 1 > 6) THEN GOTO LINE300
    IF C(B, E, Z + 1) = 0 THEN S4(Z) = 1
    T = 0: U = 0
    FOR Y = Z + 1 TO 6
        IF C(B, E, Y) = C THEN T = 1 ELSE IF C(B, E, Y) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V4(Z) = 1

    LINE300:
NEXT

W = 0
FOR Z = 1 TO 6
    IF (S1(Z) = 1) + (S2(Z) = 1) + (S3(Z) = 1) + (S4(Z) = 1) + (V1(Z) = 1) + (V2(Z) = 1) + (V3(Z) = 1) + (V4(Z) = 1) THEN W = 1
NEXT

IF W = 0 THEN GOTO GETINPUT1

LOCATE 36, 107: PRINT A$; "_";

GETINPUT2:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT2
IF ASC(A$) = 8 THEN LOCATE 36, 107: PRINT "_ ";: GOTO GETINPUT1
IF (VAL(A$) < 1) + (VAL(A$) > 6) THEN GOTO GETINPUT2
F = VAL(A$)

IF (S1(F) = 0) * (S2(F) = 0) * (S3(F) = 0) * (S4(F) = 0) * (V1(F) = 0) * (V2(F) = 0) * (V3(F) = 0) * (V4(F) = 0) THEN GOTO GETINPUT2

LOCATE 36, 108: PRINT A$;: LOCATE 36, 115: PRINT "_";

GETINPUT3:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT3
IF ASC(A$) = 8 THEN LOCATE 36, 115: PRINT " ";: LOCATE 36, 108: PRINT "_";: GOTO GETINPUT2
IF (ASC(A$) < 65) + (ASC(A$) > 70) THEN GOTO GETINPUT3
G = T(ASC(A$))

IF ((S1(F) = 1) * (G = E - 1)) + ((S2(F) = 1) * (G = E + 1)) + ((V1(F) = 1) * (G = 1)) + ((V2(F) = 1) * (G = 6)) + ((S3(F) = 1) * (E = G)) + ((S4(F) = 1) * (E = G)) + ((V3(F) = 1) * (E = G)) + ((V4(F) = 1) * (E = G)) THEN
    LOCATE 36, 115: PRINT A$; "_";
ELSE GOTO GETINPUT3
END IF

GETINPUT4:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT4
IF ASC(A$) = 8 THEN LOCATE 36, 115: PRINT "_ ";: GOTO GETINPUT3
IF (VAL(A$) < 1) + (VAL(A$) > 6) THEN GOTO GETINPUT4
H = VAL(A$)

IF ((S1(F) = 1) * (G = E - 1) * (H = F)) + ((S2(F) = 1) * (G = E + 1) * (H = F)) + ((V1(F) = 1) * (G = 1) * (H = F)) + ((V2(F) = 1) * (G = 6) * (H = F)) + ((S3(F) = 1) * (G = E) * (H = F - 1)) + ((S4(F) = 1) * (G = E) * (H = F + 1)) + ((V3(F) = 1) * (G = E) * (H = 1)) + ((V4(F) = 1) * (G = E) * (H = 6)) THEN
    LOCATE 36, 116: PRINT A$;
ELSE GOTO GETINPUT4
END IF

GETINPUT5:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT5
IF ASC(A$) = 8 THEN LOCATE 36, 116: PRINT "_";: GOTO GETINPUT4
IF ASC(A$) <> 13 THEN GOTO GETINPUT5

IF ((S1(F) = 1) * (F = H) * (G = E - 1)) + ((S2(F) = 1) * (F = H) * (G = E + 1)) + ((S3(F) = 1) * (G = E) * (H = F - 1)) + ((S4(F) = 1) * (G = E) * (H = F + 1)) THEN
    C(B, G, H) = C(B, E, F): C(B, E, F) = 0
    PUT (A(E, F) - 50, B(E, F) - 50), L(), PSET
    CIRCLE (A(G, H), B(G, H)), 50, 2: PAINT (A(G, H), B(G, H)), D(C(B, G, H)), 2: CIRCLE (A(G, H), B(G, H)), 25, 2
END IF

PUT (A(E, F) - 50, B(E, F) - 50), L(), PSET

IF ((V1(F) = 1) * (F = H) * (G = 1)) THEN
    FOR Z = E TO 1 STEP -1
        IF C(B, Z, F) = C THEN I(C) = I(C) - 1: PUT (A(Z, F) - 50, B(Z, F) - 50), L(), PSET
        C(B, Z, F) = 0
    NEXT
    C(B, 1, F) = A
    CIRCLE (A(1, F), B(1, F)), 50, 2: PAINT (A(1, F), B(1, F)), D(C(B, 1, F)), 2: CIRCLE (A(1, F), B(1, F)), 25, 2
END IF

IF ((V2(F) = 1) * (G = 6) * (H = F)) THEN
    FOR Z = E TO 6
        IF C(B, Z, F) = C THEN I(C) = I(C) - 1: PUT (A(Z, F) - 50, B(Z, F) - 50), L(), PSET
        C(B, Z, F) = 0
    NEXT
    C(B, 6, F) = A
    CIRCLE (A(6, F), B(6, F)), 50, 2: PAINT (A(6, F), B(6, F)), D(C(B, 6, F)), 2: CIRCLE (A(6, F), B(6, F)), 25, 2
END IF

IF ((V3(F) = 1) * (E = G) * (H = 1)) THEN
    FOR Z = F TO 1 STEP -1
        IF C(B, E, Z) = C THEN I(C) = I(C) - 1: PUT (A(E, Z) - 50, B(E, Z) - 50), L(), PSET
        C(B, E, Z) = 0
    NEXT
    C(B, E, 1) = A
    CIRCLE (A(E, 1), B(E, 1)), 50, 2: PAINT (A(E, 1), B(E, 1)), D(C(B, E, 1)), 2: CIRCLE (A(E, 1), B(E, 1)), 25, 2
END IF

IF ((V4(F) = 1) * (E = G) * (H = 6)) THEN
    FOR Z = F TO 6
        IF C(B, E, Z) = C THEN I(C) = I(C) - 1: PUT (A(E, Z) - 50, B(E, Z) - 50), L(), PSET
        C(B, E, Z) = 0
    NEXT
    C(B, E, 6) = A
    CIRCLE (A(E, 6), B(E, 6)), 50, 2: PAINT (A(E, 6), B(E, 6)), D(C(B, E, 6)), 2: CIRCLE (A(E, 6), B(E, 6)), 25, 2
END IF

IF I(C) < 1 THEN GOTO WINNER

SWAP A, C
GOTO STARTGAME

WINNER:
LOCATE 34, 98: PRINT "PLAYER"; A; "IS THE WINNER!!  ";
LOCATE 36, 101: PRINT "PLAY ANOTHER GAME?    ";

PLAYAGAIN:
A$ = INKEY$: IF A$ = "" THEN GOTO PLAYAGAIN
IF (A$ = "y") + (A$ = "Y") THEN RUN
IF (A$ = "n") + (A$ = "N") THEN END
GOTO PLAYAGAIN

[attachment=200]
[attachment=201][attachment=202]
[attachment=203]


RE: Overboard Board Game in QB64 - Anthony.R.Brown - 08-18-2014 03:03 PM

Another Great Game Donald Cool

I am Amazed how you keep Putting forward Board Games I have never heard of!

I have been into Board Games most of my life including all the Classics and thought I had seen them all but you keep showing me New Games...Great Stuff! Wink

P.S I Have invented a Revolutionary New Board Game myself which I will try and get round to Coding at some time ? But I want to keep the Code Secret if Possible ? because first I want to Challenge Everyone to see if they can Code their own Version of the Game...and then Pit theirs Against mine in a Tournament! 
I believe I have some Amazing A.I for the Game! but before or if I reveal the A.I ? I want to Prove myself first! Smile


Anthony. 


RE: Overboard Board Game in QB64 - Waltersmind - 08-18-2014 04:58 PM

Donald,

I have to agree with everything Anthony had said, I couldn't have said it better myself.

I love seeing all these classic games you are posting, and I admire your love for them! Please keep sharing and we will keep having fun with them!


Thanks,
Walter Whitman
The Joyful Programmer


RE: Overboard Board Game in QB64 - Waltersmind - 08-18-2014 05:00 PM

Anthony,

I love your A.I. challenge! I will have to think about that one for awhile, as I might be able to help you push the contests.

Great idea as always my friend! Keep them coming!



Walter Whitman
The Joyful Programmer


RE: Overboard Board Game in QB64 - Donald Foster - 08-19-2014 12:44 AM

Quote:
Hello everyone,

I've completed another board game. Overboard was originally written 30 years ago on the TRS-80 Model 4 and rewritten over 25 years ago on the Model 2000.

Object of the game: To be the first player to push all of your opponent's overboard.

Controls: Letters and Numbers to select board location. BACKSPACE to de-select move. ENTER to complete move.

Hope you enjoy playing.

Donald



Code Snippet: [Select]
_TITLE "Overboard by Donald L. Foster Jr."


SCREEN _NEWIMAGE(1010, 735, 256)

_LIMIT 100

_PALETTECOLOR 1, _RGB32(120, 120, 120) ' Lt Grey
_PALETTECOLOR 3, _RGB32(90, 90, 90) '    Med Grey
_PALETTECOLOR 5, _RGB32(60, 60, 60) '    Dk Grey
_PALETTECOLOR 2, _RGB32(1, 1, 1) '       Lt Black

DIM X1(60, 60), T(70), L(10004), M1(147), M2(147), M3(147), M4(147), M5(147), M6(147), MA(147), MB(147), MC(147), MD(147), ME(147), MF(147)

N$ = "D82R81G18L81U82E18"
L$(1) = "": L$(2) = "": L$(3) = "": L$(4) = "": L$(5) = "": L$(6) = ""

DEFINT P
D(1) = 15: D(2) = 4
I(1) = 18: I(2) = 18
FOR Z = 1 TO 6: T(64 + Z) = Z: NEXT
A = 1: C = 2

DATA 1,1,2,1,1,2,2,2,1,1,1,2,2,2,1,2,2,1,1,2,2,1,2,2,2,1,1,1,2,2,2,1,1,2,1,1
DATA 1,2,2,1,1,2,2,1,2,1,2,1,2,2,1,2,2,1,1,1,1,2,1,2,2,1,2,1,2,1,2,2,1,2,2,1
DATA 2,1,1,2,2,1,1,1,2,1,2,2,1,2,2,1,1,2,2,1,1,2,2,1,2,2,1,2,1,1,1,2,2,1,1,2
DATA 1,1,2,1,2,2,1,2,2,1,1,2,2,2,1,2,1,1,1,1,2,1,2,2,2,1,1,2,2,1,2,2,1,2,1,1

FOR Z = 1 TO 4: FOR Y = 1 TO 6: FOR X = 1 TO 6: READ C(Z, Y, X): NEXT: NEXT: NEXT

LOCATE 1, 2: PRINT "1 2 3 4 5 6 A B C D E F"
GET (6, 0)-(17, 13), M1()
GET (22, 0)-(33, 13), M2()
GET (38, 0)-(49, 13), M3()
GET (54, 0)-(65, 13), M4()
GET (70, 0)-(81, 13), M5()
GET (86, 0)-(97, 13), M6()
GET (102, 0)-(113, 13), MA()
GET (118, 0)-(129, 13), MB()
GET (134, 0)-(145, 13), MC()
GET (150, 0)-(161, 13), MD()
GET (166, 0)-(177, 13), ME()
GET (182, 0)-(193, 13), MF()

CLS
LOCATE 3, 48: PRINT "O   V   E   R   B   O   A   R   D";

V = 0
FOR Z = 1 TO 6
    X = 0
    FOR Y = 1 TO 6
        CIRCLE (152 + X, 250 + V), 10, D(C(1, Z, Y)): PAINT (152 + X, 250 + V), D(C(1, Z, Y))
        CIRCLE (350 + X, 250 + V), 10, D(C(2, Z, Y)): PAINT (350 + X, 250 + V), D(C(2, Z, Y))
        CIRCLE (538 + X, 250 + V), 10, D(C(3, Z, Y)): PAINT (538 + X, 250 + V), D(C(3, Z, Y))
        CIRCLE (734 + X, 250 + V), 10, D(C(4, Z, Y)): PAINT (734 + X, 250 + V), D(C(4, Z, Y))
        X = X + 25
    NEXT
    V = V + 25
NEXT

LOCATE 30, 45: PRINT "ENTER GAME SELECTION HERE. (1 TO 4) [_]";

GetGameSelection:
A$ = INKEY$
IF A$ = "" THEN GOTO GetGameSelection
IF (VAL(A$) > 0) * (VAL(A$) < 5) THEN B = VAL(A$): LOCATE 30, 82: PRINT A$;: GOTO GetGameSelection
IF ASC(A$) = 8 THEN B = 0: LOCATE 30, 82: PRINT "_";: GOTO GetGameSelection
IF ASC(A$) <> 13 THEN GOTO GetGameSelection

IF B = 0 THEN GOTO GetGameSelection

CLS
PUT (125, 3), M1()
PUT (227, 3), M2()
PUT (328, 3), M3()
PUT (429, 3), M4()
PUT (530, 3), M5()
PUT (631, 3), M6()
PUT (5, 107), MA()
PUT (5, 208), MB()
PUT (5, 309), MC()
PUT (5, 410), MD()
PUT (5, 511), ME()
PUT (5, 612), MF()

X = 0
FOR Z = 1 TO 7
    V = 0
    FOR Y = 1 TO 7
        LINE (40 + V, 20 + X)-(121 + V, 101 + X), 1, BF
        PSET (39 + V, 20 + X), 3: DRAW N$
        PAINT (37 + V, 25 + X), 3
        V = V + 101
    NEXT
    X = X + 101
NEXT

X = 0
FOR Z = 1 TO 6
    V = 0
    FOR Y = 1 TO 6
        CIRCLE (131 + V, 111 + X), 50, 2: PAINT (131 + V, 111 + X), D(C(B, Z, Y)), 2: CIRCLE (131 + V, 111 + X), 25, 2
        A(Z, Y) = 131 + V: B(Z, Y) = 111 + X
        V = V + 101
    NEXT
    X = X + 101
NEXT

X = 0
FOR Z = 1 TO 2
    V = 0
    FOR Y = 1 TO 2
        LINE (790 + V, 20 + X)-(871 + V, 101 + X), 1, BF
        PSET (789 + V, 20 + X), 3: DRAW N$
        PAINT (787 + V, 25 + X), 3
        V = V + 101
    NEXT
    X = X + 101
NEXT

GET (831, 61)-(931, 161), L()

LOCATE 44, 98: PRINT "O  V  E  R  B  O  A  R  D";

LOCATE 16, 107: PRINT "PLAYER";

LOCATE 21, 103: PRINT "S C O R E S";
LOCATE 24, 102: PRINT "PLAYER 1:";
LOCATE 26, 102: PRINT "PLAYER 2:";

STARTGAME:
PUT (831, 61), L(), PSET

CIRCLE (881, 111), 50, 2: PAINT (881, 111), D(A), 2: CIRCLE (881, 111), 25, 2

LOCATE 16, 114: PRINT A;
LOCATE 24, 112: PRINT I(1);
LOCATE 26, 112: PRINT I(2);

LOCATE 34, 98: PRINT "ENTER YOUR MOVE PATTERN.";
LOCATE 36, 101: PRINT "FROM [_ ] TO [  ].";

GETINPUT1:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT1
IF (ASC(A$) < 65) + (ASC(A$) > 70) THEN GOTO GETINPUT1
E = T(ASC(A$))

FOR Z = 1 TO 6: V1(Z) = 0: V2(Z) = 0: V3(Z) = 0: V4(Z) = 0: S1(Z) = 0: S2(Z) = 0: S3(Z) = 0: S4(Z) = 0: NEXT

FOR Z = 1 TO 6
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (E - 1 < 1) THEN GOTO LINE210
    IF C(B, E - 1, Z) = 0 THEN S1(Z) = 1
    T = 0: U = 0
    FOR Y = E - 1 TO 1 STEP -1
        IF C(B, Y, Z) = C THEN T = 1 ELSE IF C(B, Y, Z) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V1(Z) = 1

    LINE210:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (E + 1 > 6) THEN GOTO LINE240
    IF C(B, E + 1, Z) = 0 THEN S2(Z) = 1
    T = 0: U = 0
    FOR Y = E + 1 TO 6
        IF C(B, Y, Z) = C THEN T = 1 ELSE IF C(B, Y, Z) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V2(Z) = 1

    LINE240:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (Z - 1 < 1) THEN GOTO LINE270
    IF C(B, E, Z - 1) = 0 THEN S3(Z) = 1
    T = 0: U = 0
    FOR Y = Z - 1 TO 1 STEP -1
        IF C(B, E, Y) = C THEN T = 1 ELSE IF C(B, E, Y) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V3(Z) = 1

    LINE270:
    IF (C(B, E, Z) = C) + (C(B, E, Z) = 0) + (Z + 1 > 6) THEN GOTO LINE300
    IF C(B, E, Z + 1) = 0 THEN S4(Z) = 1
    T = 0: U = 0
    FOR Y = Z + 1 TO 6
        IF C(B, E, Y) = C THEN T = 1 ELSE IF C(B, E, Y) = A THEN U = 1
    NEXT
    IF (T = 1) * (U = 0) THEN V4(Z) = 1

    LINE300:
NEXT

W = 0
FOR Z = 1 TO 6
    IF (S1(Z) = 1) + (S2(Z) = 1) + (S3(Z) = 1) + (S4(Z) = 1) + (V1(Z) = 1) + (V2(Z) = 1) + (V3(Z) = 1) + (V4(Z) = 1) THEN W = 1
NEXT

IF W = 0 THEN GOTO GETINPUT1

LOCATE 36, 107: PRINT A$; "_";

GETINPUT2:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT2
IF ASC(A$) = 8 THEN LOCATE 36, 107: PRINT "_ ";: GOTO GETINPUT1
IF (VAL(A$) < 1) + (VAL(A$) > 6) THEN GOTO GETINPUT2
F = VAL(A$)

IF (S1(F) = 0) * (S2(F) = 0) * (S3(F) = 0) * (S4(F) = 0) * (V1(F) = 0) * (V2(F) = 0) * (V3(F) = 0) * (V4(F) = 0) THEN GOTO GETINPUT2

LOCATE 36, 108: PRINT A$;: LOCATE 36, 115: PRINT "_";

GETINPUT3:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT3
IF ASC(A$) = 8 THEN LOCATE 36, 115: PRINT " ";: LOCATE 36, 108: PRINT "_";: GOTO GETINPUT2
IF (ASC(A$) < 65) + (ASC(A$) > 70) THEN GOTO GETINPUT3
G = T(ASC(A$))

IF ((S1(F) = 1) * (G = E - 1)) + ((S2(F) = 1) * (G = E + 1)) + ((V1(F) = 1) * (G = 1)) + ((V2(F) = 1) * (G = 6)) + ((S3(F) = 1) * (E = G)) + ((S4(F) = 1) * (E = G)) + ((V3(F) = 1) * (E = G)) + ((V4(F) = 1) * (E = G)) THEN
    LOCATE 36, 115: PRINT A$; "_";
ELSE GOTO GETINPUT3
END IF

GETINPUT4:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT4
IF ASC(A$) = 8 THEN LOCATE 36, 115: PRINT "_ ";: GOTO GETINPUT3
IF (VAL(A$) < 1) + (VAL(A$) > 6) THEN GOTO GETINPUT4
H = VAL(A$)

IF ((S1(F) = 1) * (G = E - 1) * (H = F)) + ((S2(F) = 1) * (G = E + 1) * (H = F)) + ((V1(F) = 1) * (G = 1) * (H = F)) + ((V2(F) = 1) * (G = 6) * (H = F)) + ((S3(F) = 1) * (G = E) * (H = F - 1)) + ((S4(F) = 1) * (G = E) * (H = F + 1)) + ((V3(F) = 1) * (G = E) * (H = 1)) + ((V4(F) = 1) * (G = E) * (H = 6)) THEN
    LOCATE 36, 116: PRINT A$;
ELSE GOTO GETINPUT4
END IF

GETINPUT5:
A$ = INKEY$
IF A$ = "" THEN GOTO GETINPUT5
IF ASC(A$) = 8 THEN LOCATE 36, 116: PRINT "_";: GOTO GETINPUT4
IF ASC(A$) <> 13 THEN GOTO GETINPUT5

IF ((S1(F) = 1) * (F = H) * (G = E - 1)) + ((S2(F) = 1) * (F = H) * (G = E + 1)) + ((S3(F) = 1) * (G = E) * (H = F - 1)) + ((S4(F) = 1) * (G = E) * (H = F + 1)) THEN
    C(B, G, H) = C(B, E, F): C(B, E, F) = 0
    PUT (A(E, F) - 50, B(E, F) - 50), L(), PSET
    CIRCLE (A(G, H), B(G, H)), 50, 2: PAINT (A(G, H), B(G, H)), D(C(B, G, H)), 2: CIRCLE (A(G, H), B(G, H)), 25, 2
END IF

PUT (A(E, F) - 50, B(E, F) - 50), L(), PSET

IF ((V1(F) = 1) * (F = H) * (G = 1)) THEN
    FOR Z = E TO 1 STEP -1
        IF C(B, Z, F) = C THEN I(C) = I(C) - 1: PUT (A(Z, F) - 50, B(Z, F) - 50), L(), PSET
        C(B, Z, F) = 0
    NEXT
    C(B, 1, F) = A
    CIRCLE (A(1, F), B(1, F)), 50, 2: PAINT (A(1, F), B(1, F)), D(C(B, 1, F)), 2: CIRCLE (A(1, F), B(1, F)), 25, 2
END IF

IF ((V2(F) = 1) * (G = 6) * (H = F)) THEN
    FOR Z = E TO 6
        IF C(B, Z, F) = C THEN I(C) = I(C) - 1: PUT (A(Z, F) - 50, B(Z, F) - 50), L(), PSET
        C(B, Z, F) = 0
    NEXT
    C(B, 6, F) = A
    CIRCLE (A(6, F), B(6, F)), 50, 2: PAINT (A(6, F), B(6, F)), D(C(B, 6, F)), 2: CIRCLE (A(6, F), B(6, F)), 25, 2
END IF

IF ((V3(F) = 1) * (E = G) * (H = 1)) THEN
    FOR Z = F TO 1 STEP -1
        IF C(B, E, Z) = C THEN I(C) = I(C) - 1: PUT (A(E, Z) - 50, B(E, Z) - 50), L(), PSET
        C(B, E, Z) = 0
    NEXT
    C(B, E, 1) = A
    CIRCLE (A(E, 1), B(E, 1)), 50, 2: PAINT (A(E, 1), B(E, 1)), D(C(B, E, 1)), 2: CIRCLE (A(E, 1), B(E, 1)), 25, 2
END IF

IF ((V4(F) = 1) * (E = G) * (H = 6)) THEN
    FOR Z = F TO 6
        IF C(B, E, Z) = C THEN I(C) = I(C) - 1: PUT (A(E, Z) - 50, B(E, Z) - 50), L(), PSET
        C(B, E, Z) = 0
    NEXT
    C(B, E, 6) = A
    CIRCLE (A(E, 6), B(E, 6)), 50, 2: PAINT (A(E, 6), B(E, 6)), D(C(B, E, 6)), 2: CIRCLE (A(E, 6), B(E, 6)), 25, 2
END IF

IF I(C) < 1 THEN GOTO WINNER

SWAP A, C
GOTO STARTGAME

WINNER:
LOCATE 34, 98: PRINT "PLAYER"; A; "IS THE WINNER!!  ";
LOCATE 36, 101: PRINT "PLAY ANOTHER GAME?    ";

PLAYAGAIN:
A$ = INKEY$: IF A$ = "" THEN GOTO PLAYAGAIN
IF (A$ = "y") + (A$ = "Y") THEN RUN
IF (A$ = "n") + (A$ = "N") THEN END
GOTO PLAYAGAIN
 Thanks for the coments guys. I love sharing my games and I'm sure I have even more you've never seen before.

Donald


RE: Overboard Board Game in QB64 - Anthony.R.Brown - 08-19-2014 07:50 AM

Quote:
Anthony,

I love your A.I. challenge! I will have to think about that one for awhile, as I might be able to help you push the contests.

Great idea as always my friend! Keep them coming!



Walter Whitman
The Joyful Programmer

That's Great Walter...

What I will do when I have an actual working version of the Game I have invented is make a YouTube Video on My site showing how to Play the Game plus make a Thread all about Playing the game and the A.I Challenge Rules Etc.
As I said at first I would like to keep My Code Secret for a while...and Challenge people to make their own Version of the Game to Play against mine (Live!) Within the Game Thread!
The Games could be Played at different Speeds Between (10 - 60) Seconds Average per Move to keep the time involved manageable!
Cheating would be Ruled out! and I am Sure Not! a Problem on this Honest Site! Smile But also because all Game output could be logged and later if the Need be the Games could be Duplicated by the Programs involved to see if they actually Play the Moves!

Anthony.