programming assignment - NEED HELP!!...please (visual basic)

Started by
9 comments, last by Roger the Shrubber 21 years, 6 months ago
hello, i am in need of help. i have to do this assignment for my programming class - create a tic tac toe game....the only thing is, im not sure how to check for a winner. i figured i could use a huge if statement, but thats uncivilized. there must be a way to use a loop and a counting variable right? anyway, advise me oh wise ones.
Advertisement
I realy hate to be an ass - but it is homework. The point of homework is to figure out how to do something. Having the answer handed to you won''t help that. If using a giant nested if is the best you can come up with, then use it. Refine it later on if you feel the need.

Order of importance...

  1. Make it work
  2. Make it fast/elegant


I don''t remeber who''s sig line that is from (Jenova maybe?) - but live by it.



God was my co-pilot but we crashed in the mountains and I had to eat him...
Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
Gotta agree. I wouldn''t want programmers working with me that had to have their homework done for them.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

Yep, I''ll sign on that this is indeed homework.

But, in defense of Roger, at least he was bold enough to admit that it is homework, unlike many others. To purify it a bit, perhaps you (Roger) could give us a short write up of what you''ve done so far - how are you representing the game board? what techniques have you tried? any "pie in the sky" ideas? This will show us that you''ve thought about it, worked at it, broke a sweat, and aren''t looking for any hand outs, but rather, you''re asking for honest advice.

-Kirk
well...

You should think out a sollution yourself, but I''ll help you with my idea. But if it''s a 3x3 game it wouldn''t be that a huge if thing(8 if:s) but otherwice you might want to begin from one box and then check if it''s on a line or something like that.

(I know it didn''t help alot, but it wasn''t ment to either)

SHAME ON YOU not doing your homework

/MindWipe
"To some its a six-pack, to me it's a support group."
I must say...I''m ashamed of myself...I know I should be doing this by myself, but I panicked. I''m taking this course online, and the website that it uses is reeeeal crappy...when I go to login some days, the link will be dead...so anyway ive been trying to get in to check my grade and see about other assignments and stuff and i havent been able to for a while...then last night i finally got in and found out that i had the equivalent of a weeks worth of work DUE BY 12:00 THAT NIGHT! i got scared, but managed to finish all the work in about 3-4 hours...then i had to do this assignment, and all was well until i came to this part...but anyway, thats my story (not that you wanted to hear it or anything). And if its any consolation, yes i sweated over this for about and hour before i wrote in here. The reason im so bent on creating a loop is because thats what I just learned, so i figured it would be better to apply the new techniques to my assignment ... but yeah, if i didnt know how to, then i should have just done if statements. i would go into and explain all of what i have thought and how the program actually works, but guess what...while i slept, revelation came to me...yes! i think i know how to do it now....oh, and yeah i didnt get it handed in on time, but thats because the site was screwing up again last night, so its wasnt possible to (we''ll see if my prof believes me or not). well, thanks for the input, and i appretiate the verbal beatdown truly
bye now
quote:Original post by Landsknecht
I realy hate to be an ass - but it is homework. The point of homework is to figure out how to do something. Having the answer handed to you won''t help that. If using a giant nested if is the best you can come up with, then use it. Refine it later on if you feel the need.

Order of importance...

  1. Make it work
  2. Make it fast/elegant


I don''t remeber who''s sig line that is from (Jenova maybe?) - but live by it.



God was my co-pilot but we crashed in the mountains and I had to eat him...
Landsknecht

My sig.

Hint: Check around only the last piece placed.

---
Make it work.
Make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
Roger - I am very sorry if I came off as elitist. I didn''t mean to. Hang out on these forums a bit and you will see that quite a few folks will come here and have NO clue what they are talking about and ask for the answer to be handed to them. In the future, if you need help with something like this we, as a community, will be more than happy to help... As long as you show that you made the token effort to do it yourself.

Ideas to show effort... ( I like lists )

  1. Post source code showing what you have
  2. Psuedocode showing what you are trying to accomplish
  3. Or even a detailed narrative of things you have already tried and didn''t like


Once again, I realy do appologize for the verbal abuse (even though it was pretty mild). So, definately come back when you need help. But remeber, we will help not give answers.


God was my co-pilot but we crashed in the mountains and I had to eat him...
Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
Strangely I come up with the massive if statement as being the fastest and most elegant. (Ran faster than the any loop structure I could come up with, and was far more readable than one of my loop designs, about equally readable to the other more obvious loop design.) Your teacher will probably like the loop design and since you just learned it, I'd stick with it.

My more complex loop structure would have won if this was a large bitmap, but for a three by three array the if structure was fastest. There is some overhead in setting up a loop, so for loops as small as 3, ifs can be faster. Larger arrays however are usually better traversed with loops and logic.

Sometimes the obvious and simpler way is the better way to go.

1. Make it work
2. Make it fast/elegant

Realize you only need four ifs since you know where the last move was.

Shad

(I figure it's ok now, he says he finished his homework)



[edited by - ShadowCoder on October 2, 2002 12:58:03 PM]
People did not learn by doing nothing.

This topic is closed to new replies.

Advertisement