
-----------------------------------
Deeps of Hell
Thu Jun 05, 2003 10:01 am

CONNECT FOUR GAME
-----------------------------------
setscreen ("graphics:vga")
var brd : array 1 .. 8, 1 .. 8 of string (25)
var name : array 1 .. 2 of string (15)
var matt : array 1 .. 2 of string (5)
var n : array 1 .. 8 of int
var pl, r, c, ct, mc, d1, d2, ht, k, blah : int
var p : array 1 .. 8 of int
var gameover, ok : boolean

procedure setup
    for j : 1 .. 8
        for k : 1 .. 8
            brd (j, k) := "     "
        end for
    end for
    for j : 1 .. 8
        n (j) := 8
    end for
    pl := 1
    color (red)
    matt (1) := "  X  "
    color (black)
    matt (2) := "  O  "
end setup
procedure intro
    for j : 1 .. 2
        put "please input name ", j
        get name (j)
    end for
end intro
procedure display
    cls
    for j : 1 .. 8
        for k : 1 .. 8
            if k < 8 then
                put brd (j, k), "|" ..
            else
                put brd (j, k)
            end if
        end for
        if j < 8 then
            put "-----------------------------------------------"
        end if
    end for
end display
procedure switch
    if pl = 1 then
        pl := 2
    else
        pl := 1
    end if
end switch
procedure check
    ok := true
    if c > 8 or c < 1 then
        ok := false
        put name (pl), "please input numbers between 1->8 ONLY"
    end if
    if ok and n (c) > 0 then
        brd (n (c), c) := matt (pl)
        n (c) := n (c) - 1
    else
        ok := false
        put "pick a column that has room"
    end if
end check
procedure gamedone
    for j : 1 .. 8
        ht := 0
        for k : 1 .. 8
            if brd (j, k) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
    for j : 1 .. 8
        ht := 0
        for k : 1 .. 8
            if brd (k, j) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
    ct := 0
    ht := 0
    for d : 1 .. 5
        ct := ct + 1
        k := 0
        for j : ct .. 8
            k := k + 1
            if brd (j, k) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
    ht := 0
    ct := 9
    for d : 1 .. 5
        ct := ct - 1
        k := 9
        for decreasing j : ct .. 1
            k := k - 1
            if brd (j, k) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
    ct := 0
    ht := 0
    for d : 1 .. 5
        ct := ct + 1
        k := 9
        for j : ct .. 8
            k := k - 1
            if brd (k, j) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
    ht := 0
    ct := 9
    for d : 1 .. 5
        ct := ct - 1
        k := 0
        for decreasing j : ct .. 1
            k := k + 1
            if brd (j, k) = matt (pl) then
                ht := ht + 1
                if ht = 4 then
                    gameover := true
                end if
            else
                ht := 0
            end if
        end for
    end for
end gamedone
gameover := false
setup
intro
display
loop
    loop
        put "  1     2     3     4     5     6     7     8"
        put name (pl), " input a col number"
        get c
        check
        exit when ok
    end loop
    display
    gamedone
    exit when gameover
    switch
end loop


-----------------------------------
Prince
Thu Jun 05, 2003 10:16 am


-----------------------------------
pretty cool game... not bein a mod i dont hav unlimited bits to give away but if i could i would giv u 10 bits

-----------------------------------
Tony
Thu Jun 05, 2003 1:04 pm


-----------------------------------
simple, but works  :D 

Next step would be to use some graphics and move away from typing controls... Have players use mouse instead. Then perhaps even an animation of falling piece  8) 

Ether way +10 Bits

-----------------------------------
PaddyLong
Thu Jun 05, 2003 3:26 pm


-----------------------------------
mine's posted in this thread :D  with AI and stuff it was my final project for grade 11 computer science

-----------------------------------
The Stuff
Mon Jan 12, 2004 10:28 pm


-----------------------------------
what does the n in the proram do?

-----------------------------------
Thuged_Out_G
Tue Jan 13, 2004 3:13 pm


-----------------------------------
whats the point of having a submissions and a source code forum...if people are just going to post their source code in the submissions forum  :?  :roll:

-----------------------------------
Cervantes
Tue Jan 13, 2004 4:18 pm


-----------------------------------
submissions can be for either... source code = pure code

GJ i like it..
btw tony, those graphics own :D

-----------------------------------
shorthair
Tue Jan 13, 2004 7:02 pm


-----------------------------------
What does taht guy mean he cant give 10 bits HE HAS 400 , give him some bits dude , 

+ bits for an awsome program

-----------------------------------
the_short1
Tue Jan 20, 2004 8:35 pm


-----------------------------------
Great job.... play it when my teacher is talking endlessly about stuff i already know... +1 Bit.. i saving for title glow... so icant give more...

-----------------------------------
kalin
Wed Jan 21, 2004 4:06 pm


-----------------------------------
Cool. Its cool. And question, what is the point of bits anyway??? I"m lost on that..

-----------------------------------
shorthair
Wed Jan 21, 2004 4:12 pm


-----------------------------------
Its in the FAQ  , but a brief overview would be , you get them for good programs , 2 for posting a message ,and 1 for a thread , you can use them to buy name effects ( colors ) and you can buy tech stuff aswell , i bought an email at compsci , also you can give the m to people for good programs , the more you give the more you recieve ( its true ive seen it in action)

-----------------------------------
kalin
Wed Jan 21, 2004 4:14 pm


-----------------------------------
Well, alright.....I kinda get what you're saying....I think the FaQ will cover it better...well more...umm, I'll shut up

-----------------------------------
romper
Tue Jun 15, 2004 11:49 pm


-----------------------------------
myn is here
http://www.compsci.ca/v2/viewtopic.php?p=51823#51823

-----------------------------------
the_short1
Wed Jun 16, 2004 9:57 pm


-----------------------------------
for one ... u brought up a realy old post..... once its past the first 2 pages.... read and download the progs... but norm us compsciers dont like seing it come back up..

second...  please 
dont 'plug' your programs is other's threads...

i used to get bitched at for that... *when i was new to compsci...
.so i thought i would pass on that before the others (Asian s, Mazer, otherS) get mad....



Thanks

-----------------------------------
king_boby
Mon Jun 21, 2004 3:11 pm


-----------------------------------
it has an error as soon as i run it........

-----------------------------------
the_short1
Mon Jun 21, 2004 7:38 pm


-----------------------------------
posting the error message is good so we can know how to fix..
.

probable cause: u didn;ed copy the whpole code..
