Computer Science Canada hey guys, wondering if you can help me make domino game |
Author: | werdMeistah [ Sun Jan 11, 2004 9:08 pm ] |
Post subject: | hey guys, wondering if you can help me make domino game |
im having real trouble, the classes that im doing are tangling and everyt hings a mess ... no GUI needed though aight ima check back thx again ppl |
Author: | poly [ Sun Jan 11, 2004 9:33 pm ] |
Post subject: | |
well hmm here are some ideas (not sure if they would or not) - draw images representing the dominos - using arrays make a grid pattern on the screen lets say, make the gameplay 20x20 and make each grid a rectangle shape (dimensions could be like 20x10) - Hmm you could use keyboard buttons to rotate the domino peice - than you'd have to write up like a procedure that would check the dominos on the grid and make sure the current domino that you are placing will fit into the grid. That would be tricky, but I can think of a way that it might work (but really hard to explain). theres some ideas, im guessing others have more and better ideas |
Author: | Cervantes [ Sun Jan 11, 2004 9:38 pm ] |
Post subject: | |
well you mean the game dominos (which I don't know how to play) or the funness of making a maze of dominoes and then knocking them over |
Author: | werdMeistah [ Sun Jan 11, 2004 9:44 pm ] |
Post subject: | well... |
well heres what i mean check it out http://j_carrillo_vii.tripod.com/dominoes.htm#BasicGame |
Author: | GrandAvalon [ Sun Jan 11, 2004 10:26 pm ] |
Post subject: | |
Can you post what you have so far? |
Author: | werdMeistah [ Tue Jan 13, 2004 6:33 pm ] |
Post subject: | here |
class Domino export setValue, value, putDomino, startInt var x : int := 0 var y : int := 0 var xB : int := 0 var yB : int := 0 var startInt : int var orientation : int := 0 % procedure setvalue % purpose : This procedure sets the value of the domino to an integer % parameters : one procedure setValue (value : int) startInt := value end setValue % function Value % purpose : This function results the value given % parameters : none function value : int result startInt end value % procedure putdomino % purpose : This procedure will draw the domino pattern based on the parameters % given % parameters : four ( x, y , faceUp, orientation) procedure putDomino (var x, y, orientation : int) var x2 : int var y2 : int x2 := x2 + 60 y2 := y2 + 30 var faceup : boolean := false if orientation = 2 then Draw.Box (x, y, x2, y2, black) Draw.Box (xB + 40, yB, x, y2, black) elsif orientation = 1 then Draw.Box (x, y, x2, y2, blue) Draw.Box (xB, yB + 40, x2, y2, black) end if end putDomino % procedure draw dots % purpose : this procedure draws the dots through procedure putDomino procedure drawDots var dotsDraw : int var dotsDrawB : int dotsDraw := startInt div 10 case dotsDraw of label 0 : Draw.Line (300, 20, 400, 10, white) label 1 : Draw.FillOval (x + 20, y + 20, 2, 2, red) label 2 : Draw.FillOval (x + 10, y + 20, 2, 2, red) Draw.FillOval (x + 30, y + 20, 2, 2, red) label 3 : Draw.FillOval (x + 10, y + 30, 2, 2, red) Draw.FillOval (x + 20, y + 20, 2, 2, red) Draw.FillOval (x + 30, y + 10, 2, 2, red) label 4 : Draw.FillOval (x + 10, y + 30, 2, 2, red) Draw.FillOval (x + 10, y + 10, 2, 2, red) Draw.FillOval (x + 30, y + 30, 2, 2, red) Draw.FillOval (x + 30, y + 10, 2, 2, red) label 5 : Draw.FillOval (x + 10, y + 30, 2, 2, red) Draw.FillOval (x + 10, y + 10, 2, 2, red) Draw.FillOval (x + 30, y + 30, 2, 2, red) Draw.FillOval (x + 30, y + 10, 2, 2, red) Draw.FillOval (x + 20, y + 20, 2, 2, red) label 6 : Draw.FillOval (x + 10, y + 10, 2, 2, red) Draw.FillOval (x + 10, y + 20, 2, 2, red) Draw.FillOval (x + 10, y + 30, 2, 2, red) Draw.FillOval (x + 30, y + 10, 2, 2, red) Draw.FillOval (x + 30, y + 20, 2, 2, red) Draw.FillOval (x + 30, y + 30, 2, 2, red) end case % procedure drawDotsB % purpose : This procedure draws the second dice sequence of the domino dotsDrawB := startInt mod 10 case dotsDrawB of label 0 : Draw.Line (300, 20, 400, 10, white) label 1 : Draw.FillOval (xB + 20, yB + 20, 2, 2, red) label 2 Draw.FillOval (xB + 10, yB + 20, 2, 2, red) Draw.FillOval (xB + 30, yB + 20, 2, 2, red) label 3 : Draw.FillOval (xB + 10, yB + 30, 2, 2, red) Draw.FillOval (xB + 20, yB + 20, 2, 2, red) Draw.FillOval (xB + 30, yB + 10, 2, 3, red) label 4 : Draw.FillOval (xB + 10, yB + 30, 2, 2, red) Draw.FillOval (xB + 10, yB + 10, 2, 2, red) Draw.FillOval (xB + 30, yB + 30, 2, 2, red) Draw.FillOval (xB + 30, yB + 10, 2, 3, red) label 5 : Draw.FillOval (xB + 10, yB + 30, 2, 2, red) Draw.FillOval (xB + 10, yB + 10, 2, 2, red) Draw.FillOval (xB + 30, yB + 30, 2, 2, red) Draw.FillOval (xB + 30, yB + 10, 2, 2, red) Draw.FillOval (xB + 20, yB + 20, 2, 3, red) label 6 : Draw.FillOval (xB + 10, yB + 10, 2, 2, red) Draw.FillOval (xB + 10, yB + 20, 2, 2, red) Draw.FillOval (xB + 10, yB + 30, 2, 2, red) Draw.FillOval (xB + 30, yB + 10, 2, 2, red) Draw.FillOval (xB + 30, yB + 20, 2, 2, red) Draw.FillOval (xB + 30, yB + 30, 2, 2, red) end case end drawDots end Domino class Hand import Domino export dominoProc, size, putHand var hand : array 1 .. 7 of int var size : int := 7 % function dominoproc % purpose : This function returns the numbered value in the tile array % parameters : none function dominoProc : int var randomInt : int var checkInt : int randint (randomInt, 0, 66) for i : 0 .. 66 if randomInt = hand (i) then randint (randomInt, 0, 66) else randomInt := checkInt end if end for result randomInt end dominoProc % function size % purpose : This function returns the size of the hand % parameters : none function sizeDom : int var size : int result size end sizeDom % procedure add domino % purpose : This procedure adds a domino to the end of the array. % parameters : none procedure addDomino end addDomino % procedure find % purpose : This procedure returns the given value in the hand % parameters : x procedure findValue (var x : int) var IndexNum : int for i : 1 .. 7 if hand (i) = x then IndexNum := hand (i) end if end for end findValue % procedure drop/remove value % purpose : This procedure removes a given value from the hand % parameters : x procedure dropValue (var x : int) for i : 1 .. 7 if hand (i) = x then hand (i) := 0 end if end for end dropValue % procedure putHand % purpose : This procedure prints the hand of the players % parameters : four (x, y, faceup, orientation) procedure putHand (var x, y, orientation : int) var count : int var countB : int var countC : int var countD : int for i : 1 .. 7 for i2 : 1 .. 7 if y > 50 then y := y + 10 end if if count > 4 then x := x + 5 elsif count <= 4 then x := x + 0 end if end for x := x + 10 y := y + 50 count := count + 1 orientation := orientation + 1 end for for i : 1 .. 7 for i2 : 1 .. 7 if y > 50 then y := y + 10 end if if countB > 4 then x := x + 5 elsif countB <= 4 then x := x + 0 end if end for x := x + 300 y := y + 50 countB := countB + 1 orientation := orientation + 1 end for for i : 1 .. 7 for i2 : 1 .. 7 if x >= 10 then x := x + 50 end if if countC > 4 then y := y - 5 elsif countC <= 4 then y := y + 0 end if end for x := x + 100 y := y + 20 countC := countC + 1 orientation := orientation + 2 end for for i : 1 .. 7 for i2 : 1 .. 7 if x >= 10 then x := x + 50 end if if countC > 4 then y := y - 5 elsif countC <= 4 then y := y + 0 end if end for x := x + 100 y := y + 300 countC := countC + 1 orientation := orientation + 2 end for end putHand % procedure sort array % purpose : To sort the domino tile array from least to greatest procedure sortArray var tempInt : int for i : 1 .. 6 if hand (i) > hand (i + 1) then hand (i + 1) := tempInt hand (i) := hand (i + 1) tempInt := hand (i) elsif hand (i) < hand (i + 1) then hand (i) := hand (i) hand (i + 1) := hand (i + 1) end if end for end sortArray end Hand class Table var table : array 1 .. 28 of int var size : int var left : int var right : int % procedure left % purpose : This procedure indicates if it is located in the % left or the right side of the chain % parameters : none procedure leftB end leftB % procedure right % purpose : This procedure indicates if it is located in the % left or the right side of the chain % parameters : none procedure rightB end rightB % procedure add % purpose : This procedure adds the domino to the left or the right side of the chain % parameters : leftB, rightB procedure addB (var left, right : int) end addB end Table |
Author: | GrandAvalon [ Wed Jan 14, 2004 8:15 pm ] |
Post subject: | |
So do you want us to edit your code and fix the errors or tell you want is wrong? Or just finish the program which you have started? At this stage you are FAR from completing the game. |
Author: | werdMeistah [ Tue Jan 20, 2004 7:27 pm ] |
Post subject: | please |
it would be greately appreciated if you can finish what i have started, thank you again for your comments, |
Author: | BBPProductions [ Wed Jun 03, 2009 10:21 am ] |
Post subject: | Re: hey guys, wondering if you can help me make domino game |
Did you ever finish? I know it was a while ago. Can i see the updated code? Or the finished code? |
Author: | apomb [ Wed Jun 03, 2009 10:57 am ] |
Post subject: | RE:hey guys, wondering if you can help me make domino game |
A five year old post... i think you have the record, BBPProductions. there should be an auto-lock for this kind of thing |
Author: | Dusk Eagle [ Wed Jun 03, 2009 3:35 pm ] |
Post subject: | Re: hey guys, wondering if you can help me make domino game |
BBPProductions, if you are making a dominoes game and need help, just post a separate topic rather than necro-post in a five year old thread. |
Author: | BBPProductions [ Thu Jun 04, 2009 9:29 am ] |
Post subject: | RE:hey guys, wondering if you can help me make domino game |
I have to do a Dominos game in my class, but not until next year, I just wanted to see it. it would have been very Helpful... if the post is still up im sure its fair game to reply on it and i did write i know this post is old.. That was my first post on this Fourm You guys are pretty Rude... |