Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / i am a failure as a db programmer :'(

Author
Message
sorcre
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: United States
Posted: 16th Feb 2003 05:11
it took me 60 lines to make a mexed up tic tac to game with over 20 bugs and only text. i am a failure! HERE IS THE STUPID CODE
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 16th Feb 2003 05:45
hey man, at leaset you've found your bugs! i'm still looking for mine!

your birth was a blessing, sent to live and die on earth as a lesson, we each have a star all you have to do is find it, once you do, everyone who sees it will be blinded - DMX
sorcre
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: United States
Posted: 16th Feb 2003 05:46
who said i found them! i have no idea where they are

freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 16th Feb 2003 15:09
but do not chose 1 above 9

what do you mean with this?

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Feb 2003 15:30
thats a really odd way to do this
i'd make it using more conventional method (^_^)

firstly we'll setup the main game


we then want to make a small arena for using as the tic tac toe board



now we have our board we'll want position for the text or drawn X's and O's to go in
so next thing to do is to setup a 9 position array for this too



notice that the input is identical to the _draw_board ... this is because both must be sized exactly the same to work

and as the game array is included in the function it shouldn't be placed in an external array because it has been setup exclusively for this game.

you notice we made 3 elements to each square?
well 1 & 2 are the X Y positions ... and the thrid will be used for the actual game itself as its to be the fill type.
so we can set this up now.



now we have our peices, how about we make something to draw them? (^_^)
here we'll cover 2 functions and a simple IF statement that checks the array.



you'll notice rather than using the = i used the not word, this basically means that if the answer is anything BUT that then run the if

oh man were almost finished now and perhaps might not seem like it, but there is just a little bit left to go.
what we have left is the player control and to check who wins.

firstly the player control as this is quite simplistic



now that we have the player control lets give the players thier turns.
remember what you just wrote late, well now its time to edit that to accomidate for the player turns



final peice of actual code is to setup a winner check, which is quite lengthy - however this part can be presaved because it never changes
now again we'll make an array for this and this time a gosub for filling the information (^_^)



now that we have our winning array the actual function to check if someone won is quite simple to make



in this state however the code probably seems quite unusable as its all over the shop
well this last code section is the game completed and finished off



from this it isn't that hard to actually make a 3D version if you wanted
well enjoy

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 16th Feb 2003 15:39
Raven your bored arent you

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Feb 2003 15:40
hehee how'd you guess?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 16th Feb 2003 17:41
Don't feel bad sorcre, it took me forever to get the hang of basic. keep trying and eventually you'll get it, and once you do you'll be glad you did!

Whatever I did it wasn't me!
Daz
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: United Kingdom
Posted: 16th Feb 2003 17:52
Hey, know the feeling, pal. I'm new to it too and I can't even make a basic 2D pong game and I get a lot of stick from my mates because of it. Let's go forward together.

DarkBASIC Professional is the best programming utility.
8/10 Housewives agree!
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 16th Feb 2003 20:54
don't know why, i never ever started small, like all the pro's say make pong, make tetris b4 u go further, i just when't further, althoguh i do have a feeling it would take a while for me to make pong

your birth was a blessing, sent to live and die on earth as a lesson, we each have a star all you have to do is find it, once you do, everyone who sees it will be blinded - DMX
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Feb 2003 21:43
the reason your recommended to start small is becuase although the larger titles perhaps might seem easier, in actual fact your learning the lessons on howto program rather than the advancements of programming when you create them.

you can't learn to run before you walk, else you'll never quite master either (^_^)

normally i wouldn't post up code when someone asks for help like this - however its obvious that this was a valid attempt rather than someone wanting them to program fully for them ... and the attempt has to be admired

hopefully you can take what i've shown you and have a good stepping stone to work from

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Feb 2003 23:15
i just tried to run the code...



i made some stupid mistakes i've fixxed there, however one bug remains - for some reason it won't accept i've declared the label i've tried renaming its umpteen ways, still get (label not declared )

perhaps someone else can explain why, i've not used labels much before - and i've seen them working in other programs so i assumed it would for my own. odd eh?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Feb 2003 00:22
I don't think you can use a goto to jump out of a function - looks like some restructuring is in order
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Feb 2003 00:46
lol ya i think so too ... i'd like a request to be placed on patch 1.14

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2024-05-18 12:13:46
Your offset time is: 2024-05-18 12:13:46