Computer Science Canada

Help on my project due in two days

Author:  firex2249 [ Wed Jan 16, 2008 5:25 pm ]
Post subject:  Help on my project due in two days

I have a project and the main problem I am facing is dragging words and almost everything else. So can some explain to what i can do to finish this project, plz. It wil be so happy. The instructions for my project are:

You have been hired by the grade 5 English teacher to test a student's ability to put 5 words in alphabetical order. Five randoms words are displayed vertically on the left side of the screen with 5 empty vertical spaces on the right. The students selects each word and moves it to right side of the screen placing it correctly in order. If the words are in correct alphabetical order, a green LED flashes on a corresponding peripheral to indicate the entry is correct. If not, a red LED flashes.

THANKS AGAIN IF YOU HELP ME

Author:  Gooie [ Wed Jan 16, 2008 7:10 pm ]
Post subject:  Re: Help on my project due in two days

So what your saying is you want us to do the project for you?

*Pop Up*
You have performed an illegal operation.

Author:  firex2249 [ Wed Jan 16, 2008 7:16 pm ]
Post subject:  Re: Help on my project due in two days

No i should have been clear, i meant help me drag words. Srry for the trouble.Here is what i got so far:


put " Alphabetical Order Game"
put "List of words:"..
put " Words in alphabetical order:"
put ""
put "Noob"
put ""
put "ball"
put ""
put "keyboard"
put ""
put "book"
put ""
put "ruler"



drawbox (50, 50, 125, 125, blue)
locatexy (75, 82)
put "EXIT" ..

var x, y, button : int

loop
mousewhere (x, y, button)
% If button the is clicked, exits the program.
exit when 50 <= x and x <= 125 and 50 <= y and y <= 125 and button = 1

Author:  Tony [ Wed Jan 16, 2008 7:16 pm ]
Post subject:  RE:Help on my project due in two days

If the use of a mouse to drag things confuses you, you could choose to settle for keyboard input to finish the project.

Otherwise use Mouse.Where() to figure out where the pointer is, and change a target word's location to the same set of co-ordinates.

Author:  firex2249 [ Wed Jan 16, 2008 7:19 pm ]
Post subject:  Re: RE:Help on my project due in two days

Tony @ Wed Jan 16, 2008 7:16 pm wrote:
If the use of a mouse to drag things confuses you, you could choose to settle for keyboard input to finish the project.

Otherwise use Mouse.Where() to figure out where the pointer is, and change a target word's location to the same set of co-ordinates.


So can you explain to me where to use it cause I am beginner

Author:  syntax_error [ Wed Jan 16, 2008 8:33 pm ]
Post subject:  Re: Help on my project due in two days

yes we can show you here find it on your own
magical

Author:  firex2249 [ Wed Jan 16, 2008 10:05 pm ]
Post subject:  Re: Help on my project due in two days

Well i didnt use the mouse where but settled for keyboard, so thx:


put " Alphabetical Order Game"
put "*To exit the game type:stop*"

put "List of words:"

put "a.noob"

put "b.ball"

put "c.keyboard"

put "d.book"

put "e.ruler"
loop
var word : string

put ""
put "Please put the words in orders(ex. a,b,c,d,e)"
get word

if word = "b,d,c,a,b" then
put "WEll DONE"
parallelput (1)
else
put "Invalid choice"
parallelput (2)
exit when word = "stop"
end if
end loop

Author:  StealthArcher [ Wed Jan 16, 2008 10:07 pm ]
Post subject:  RE:Help on my project due in two days

Nice, now if you want, try to improve it to using the mouse, since you do have something to hand in, no stress.

Author:  Zampano [ Wed Jan 16, 2008 10:23 pm ]
Post subject:  Re: Help on my project due in two days

That would be an excellent entry, except for the typo that makes it faulty.The correct last word is 'e'.
If you want to do it with the mouse, then you should hold variables which represent the x and y locations of each word. Then, compare the location of the mouse to the location of each word, thus determining if the mouse is over the word. If it is, check if the mousebutton is down. That given, adjust the word location so that the mouse is about in the middle of it (the mouse can only move a bit each moment, so the word will continue to follow the mouse as long as the button is down and the location is within the bounds of the x and y of the word being carried.
To improve the program, you can use a value to hold information on whether or not the cursor currently has a word attached to it, so that you can make it ignore other words if one is currently being carried.

Author:  firex2249 [ Thu Jan 17, 2008 5:44 pm ]
Post subject:  Re: Help on my project due in two days

Zampano @ Wed Jan 16, 2008 10:23 pm wrote:
That would be an excellent entry, except for the typo that makes it faulty.The correct last word is 'e'.
If you want to do it with the mouse, then you should hold variables which represent the x and y locations of each word. Then, compare the location of the mouse to the location of each word, thus determining if the mouse is over the word. If it is, check if the mousebutton is down. That given, adjust the word location so that the mouse is about in the middle of it (the mouse can only move a bit each moment, so the word will continue to follow the mouse as long as the button is down and the location is within the bounds of the x and y of the word being carried.
To improve the program, you can use a value to hold information on whether or not the cursor currently has a word attached to it, so that you can make it ignore other words if one is currently being carried.


what do u mean by compare the location of the mouse to the location of each word?
is there code for that with mouse where and this what i did so far:

var x, y, button : int
loop
Mouse.Where (x, y, button)
locatexy (1, 300)
put "apple"
if button = 1 then
end if
end loop

Author:  Tony [ Thu Jan 17, 2008 5:56 pm ]
Post subject:  RE:Help on my project due in two days

no, it's more like
Turing:

var x, y, button : int
loop
   Mouse.Where (x, y, button)
   locatexy (x,y)
   put "apple"
   cls
end loop

Author:  firex2249 [ Thu Jan 17, 2008 5:56 pm ]
Post subject:  Re: Help on my project due in two days

Using this i can see the same word twice but how can i make it let the second stay instead of disappering when i let the mouse button go, here it is:

var x, y, button : int
loop
Mouse.Where (x, y, button)
locatexy (1, 300)
put "apple"
if button = 1 then
locatexy (100,300)
put "apple"
end if
end loop

Author:  firex2249 [ Thu Jan 17, 2008 6:18 pm ]
Post subject:  Re: RE:Help on my project due in two days

Tony @ Thu Jan 17, 2008 5:56 pm wrote:
no, it's more like
Turing:

var x, y, button : int
loop
   Mouse.Where (x, y, button)
   locatexy (x,y)
   put "apple"
   cls
end loop


So if that allows me to hold on to it how do I let the word go and stays at the postion untill selected again?(This stuff is hard>Sad)

Author:  Nick [ Thu Jan 17, 2008 6:21 pm ]
Post subject:  RE:Help on my project due in two days

try something like
Turing:
var mx,my,mb:int
var wordx,wordy:int
wordx:=1
wordy:=300
loop
    cls
    Mouse.Where (mx, my, mb)
    locatexy (wordx, wordy)
    put "apple"
    if button = 1 then
        wordx:=mx
        wordy:=my
    end if
end loop

Author:  firex2249 [ Thu Jan 17, 2008 6:26 pm ]
Post subject:  Re: RE:Help on my project due in two days

momop @ Thu Jan 17, 2008 6:21 pm wrote:
try something like
Turing:
var mx,my,mb:int
var wordx,wordy:int
wordx:=1
wordy:=300
loop
    cls
    Mouse.Where (mx, my, mb)
    locatexy (wordx, wordy)
    put "apple"
    if button = 1 then
        wordx:=mx
        wordy:=my
    end if
end loop

I tried it didnt work, thanks anyways:(

Author:  Zampano [ Thu Jan 17, 2008 7:05 pm ]
Post subject:  Re: Help on my project due in two days

It does, you just need to change his variable name from 'button' to 'mb' to eliminate the ensuing error.

Author:  firex2249 [ Thu Jan 17, 2008 7:19 pm ]
Post subject:  Re: Help on my project due in two days

I did what you asked know how do u do that with my 5 words at the same , i tried this but it didnt work, also i want to add an exit button at the same how can i do that together, like its going to be a game and stuff:


var mx1, my1, mb1 : int
var wordx1, wordy1 : int
wordx1 := 1
wordy1 := 300
loop
cls
Mouse.Where (mx1, my1, mb1)
locatexy (wordx1, wordy1)
put "Noob"
if mb1 = 1 then
wordx1 := mx1
wordy1 := my1
end if
end loop

var mx2, my2, mb2 : int
var wordx2, wordy2 : int
wordx2 := 1
wordy2 := 300
loop
cls
Mouse.Where (mx2, my2, mb2)
locatexy (wordx2, wordy2)
put "Ball"
if mb2 = 1 then
wordx2 := mx2
wordy2 := my2
end if
end loop
var mx3, my3, mb3 : int
var wordx3, wordy3 : int
wordx3 := 1
wordy3 := 300
loop
cls
Mouse.Where (mx3, my3, mb3)
locatexy (wordx3, wordy3)
put "Keyboard"
if mb3 = 1 then
wordx3 := mx3
wordy3 := my3
end if
end loop
var mx4, my4, mb4 : int
var wordx4, wordy4 : int
wordx4 := 1
wordy4 := 300
loop
cls
Mouse.Where (mx4, my4, mb4)
locatexy (wordx4, wordy4)
put "Book"
if mb4 = 1 then
wordx4 := mx4
wordy4 := my4
end if
end loop

var mx5, my5, mb5 : int
var wordx5, wordy5 : int
wordx5 := 1
wordy5 := 300
loop
cls
Mouse.Where (mx5, my5, mb5)
locatexy (wordx5, wordy5)
put "Ruler"
if mb5 = 1 then
wordx5 := mx5
wordy5 := my5
end if
end loop

Author:  Yagami_Light [ Thu Mar 20, 2008 8:18 pm ]
Post subject:  Re: Help on my project due in two days

I saw this post a couple of days ago and thought the program looked interesting so i decided to make it and I'm attaching it to this post.
To move the words you have to click on them and drag them to a different place without letting go the button and then let go when you placed them where you wanted. Don't move the mouse too fast or you will lose the word. You have to click on submit when you are done moving the words.I used Bubble sort to sort the words in alphabetical order and it works well because there aren't many things to sort. So tell me what you think =3

Author:  A.J [ Fri Mar 21, 2008 7:47 am ]
Post subject:  Re: Help on my project due in two days

hey firex2249
welcome to compsci.ca!

try changing 'button' to 'mb' and it should work + add View.Update to make a flicker free animation:
Turing:

View.Set ("offscreenonly")
var mx, my, mb : int
var wordx, wordy : int
wordx := 1
wordy := 300
loop
    cls
    Mouse.Where (mx, my, mb)
    locatexy (wordx, wordy)
    put "apple"
    if mb = 1 then
        wordx := mx
        wordy := my
    end if
    View.Update
end loop

I suggest that you learn more about mouse/keyboard manipulation.

A.J


: