Im making a Yahtzee game and i am really confused right now....its not working right
Author |
Message |
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 8:30 pm Post subject: Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
Im in a gr.10 computer tech and our assignment is to make a game on turing...the game is due 2morrow and im having a lot of problems with the scoring of the game...the game worked perfectly b4 i tried to do the scoring...it still holds the dice and unholds it but the scoring is not working...im gonna attach my game so i really hope someone can help be...i just wanna warn u...my game is really long right now and im using procedures so everything is all over the place...thx ur help is really appriciated
Description: |
|
Download |
Filename: |
YAHTZEE.T |
Filesize: |
26.67 KB |
Downloaded: |
154 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Clayton
|
Posted: Thu Jan 11, 2007 10:17 pm Post subject: Re: Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
First of all, posting a topic THREE times to try and get help is not going to help you in any way. In fact, it will make people less likely to help you, so cut down on the spamming. In the meanwhile, I am going to look at your code, more to come.
|
|
|
|
|
|
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 10:19 pm Post subject: RE:Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
srry... i was just trying to reword it so ppl would read it...and thx ur help is really appriciated
|
|
|
|
|
|
Clayton
|
Posted: Thu Jan 11, 2007 10:40 pm Post subject: Re: Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
Well let's start simple:
Turing: |
%under a
locatexy (111, 320)
put " HOLD"
%drawbox (100, 320, 150, 338, 15)
drawbox (x (1), y (1), x
(1) + 50, y (1) +
18, 15)
locatexy (105, 300)
put "UNHOLD"
%drawbox (100,295,150,313,15)
drawbox (j (1), k (1), j
(1) + 50, k (1) +
18, 15)
%under b
locatexy (211, 320)
put "HOLD"
%drawbox (200, 320, 250, 338, 15)
drawbox (x (2), y (2), x
(2) + 50, y (2) +
18, 15)
locatexy (205, 300)
put "UNHOLD"
%drawbox (200,295,250,313,15)
drawbox (j (2), k (2), j
(2) + 50, k (2) +
18, 15)
%under c
locatexy (311, 320)
put " HOLD"
%drawbox (300, 320, 350, 338, 15)
drawbox (x (3), y (3), x
(3) + 50, y (3) +
18, 15)
locatexy (305, 300)
put "UNHOLD"
%drawbox (300,295,350,313,15)
drawbox (j (3), k (3), j
(3) + 50, k (3) +
18, 15)
%under d
locatexy (411, 320)
put "HOLD"
%drawbox (400, 320, 450, 338, 15)
drawbox (x (4), y (4), x
(4) + 50, y (4) +
18, 15)
locatexy (405, 300)
put "UNHOLD"
%drawbox (400,295,450,313,15)
drawbox (j (4), k (4), j
(4) + 50, k (4) +
18, 15)
%under e
locatexy (511, 320)
put " HOLD"
%drawbox (500, 320, 550, 338, 15)
drawbox (x (5), y (5), x
(5) + 50, y (5) +
18, 15)
locatexy (505, 300)
put "UNHOLD"
%drawbox (500,295,550,313,15)
drawbox (j (5), k (5), j
(5) + 50, k (5) +
18, 15)
|
/me shudders, what you should've done, is write a procedure to do this, then call the procedure passing coordinates as arguments
Turing: |
var hold1 : int := 0
var hold2 : int := 0
var hold3 : int := 0
var hold4 : int := 0
var hold5 : int := 0
|
I noticed you used arrays in other parts of your program, so why not here?
Turing: |
var OnesScore : int := 0
var TwosScore : int := 0
var ThreesScore : int := 0
var FoursScore : int := 0
var FivesScore : int := 0
var SixesScore : int := 0
var Total : int := 0
var Bonus : int := 0
var UpperTotal : int := 0
|
By convention, variable names start with lower case letters, and you use eithe camelCase or names_like_this
What version of Turing are you using? For anything relatively new, this procedure is far outdated and depriceated, it's not needed.
Turing: |
if a = 1 then
OnesScore := OnesScore + 1
elsif b = 1 then
OnesScore := OnesScore + 1
elsif c = 1 then
OnesScore := OnesScore + 1
elsif d = 1 then
OnesScore := OnesScore + 1
elsif e = 1 then
OnesScore := OnesScore + 1
else
OnesScore := 0
end if
|
Why not:
Turing: |
if a = 1 or b = 1 or c = 1 or d = 1 or e = 1 then
OnesScore += 1
end if
|
?
Also, I found a bug, when you hold dice, it will seemingly enter an infinite loop, not good :S
|
|
|
|
|
|
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 10:43 pm Post subject: RE:Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
Turing:
%under a
locatexy (111, 320)
put " HOLD"
%drawbox (100, 320, 150, 338, 15)
drawbox (x (1), y (1), x
(1) + 50, y (1) +
18, 15)
locatexy (105, 300)
put "UNHOLD"
%drawbox (100,295,150,313,15)
drawbox (j (1), k (1), j
(1) + 50, k (1) +
18, 15)
%under b
locatexy (211, 320)
put "HOLD"
%drawbox (200, 320, 250, 338, 15)
drawbox (x (2), y (2), x
(2) + 50, y (2) +
18, 15)
locatexy (205, 300)
put "UNHOLD"
%drawbox (200,295,250,313,15)
drawbox (j (2), k (2), j
(2) + 50, k (2) +
18, 15)
%under c
locatexy (311, 320)
put " HOLD"
%drawbox (300, 320, 350, 338, 15)
drawbox (x (3), y (3), x
(3) + 50, y (3) +
18, 15)
locatexy (305, 300)
put "UNHOLD"
%drawbox (300,295,350,313,15)
drawbox (j (3), k (3), j
(3) + 50, k (3) +
18, 15)
%under d
locatexy (411, 320)
put "HOLD"
%drawbox (400, 320, 450, 338, 15)
drawbox (x (4), y (4), x
(4) + 50, y (4) +
18, 15)
locatexy (405, 300)
put "UNHOLD"
%drawbox (400,295,450,313,15)
drawbox (j (4), k (4), j
(4) + 50, k (4) +
18, 15)
%under e
locatexy (511, 320)
put " HOLD"
%drawbox (500, 320, 550, 338, 15)
drawbox (x (5), y (5), x
(5) + 50, y (5) +
18, 15)
locatexy (505, 300)
put "UNHOLD"
%drawbox (500,295,550,313,15)
drawbox (j (5), k (5), j
(5) + 50, k (5) +
18, 15)
/me shudders, what you should've done, is write a procedure to do this, then call the procedure passing coordinates as arguments
alright lol i do have a procedure 4 that ^ but t he procedure has other stuff in it too
|
|
|
|
|
|
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 10:44 pm Post subject: RE:Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
what i desperately need help with at this point is the scoring...i can get it to work
|
|
|
|
|
|
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 10:46 pm Post subject: Re: Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
ooo and is the version u just looked at the one where u press the hold button and the outline around the dice turns green...
|
|
|
|
|
|
Clayton
|
Posted: Thu Jan 11, 2007 10:59 pm Post subject: Re: Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
thank you very much for the triple post, there is an edit button for a reason. I honestly have no clue where to even begin looking for your error, as the code is so all over the place. This is why organizing your code early on helps so much.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
xXKRISSYXx
|
Posted: Thu Jan 11, 2007 11:07 pm Post subject: RE:Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
i tried organizing it but it didnt work out lol and srry bout the triple post...i didnt realize there was an edit button...if i were to orgaize it better now do u think u can help?
there i organized it better and but more programmer comments
Description: |
|
Download |
Filename: |
YAHTZEE.T |
Filesize: |
26.67 KB |
Downloaded: |
109 Time(s) |
|
|
|
|
|
|
ericfourfour
|
Posted: Fri Jan 12, 2007 12:19 am Post subject: RE:Im making a Yahtzee game and i am really confused right now....its not working right |
|
|
Before even asking for anymore help I recommend checking out the tutorial on procedures and functions, and the tutorial on arrays in the Turing Walkthrough. Knowledge of these concepts will greatly decrease the amount of lines you wrote.
|
|
|
|
|
|
|
|