Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Which way is the object pointing to
Old
roofy
Guest
 
Status:
Posts: n/a
Default Which way is the object pointing to - 11-04-2006, 11:01 AM

Hi there, for my second project, I have created a simplified version of the game horseshoes. As for the code, I gotten as far as letting player1 toss his or her 2 horseshoes, and then give the computer a turn to toss its 2 horseshoes. So now I am ready to calculate both players score, but the problem I am having with is finding if the current horseshore that is being checked for is a ringer or not. The only thing I can come up with is to somehow create some code that checks if the given horseshoe is pointing towards the horseshoe pole. However, I cannot find any prebuilt method or function that can do what I want it to do. So can anyone else think of another way I could do this?
   
Reply With Quote
A Ringer?
Old
DrJim
Guest
 
Status:
Posts: n/a
Question A Ringer? - 11-04-2006, 06:26 PM

Haven't seen what you're trying to do but wouldn't a simple distance check work. The origins of both parts would have to be correct but, for the first two I looked at - magic wand and magnet - they were ok. In the picture shown, for example, a simple "magnets distance to wand is less than half the magnet's width'' check would seem like it would work.
Attached Images
File Type: jpg ringer.JPG (4.7 KB, 101 views)
   
Reply With Quote
Old
roofy
Guest
 
Status:
Posts: n/a
Default 11-05-2006, 07:17 AM

The problem with that is you have not checked if the horseshoe is facing the other direction. Here is an example of what I mean that would not be consider as a ringer
Attached Images
File Type: jpg horseshoe example.JPG (5.8 KB, 123 views)
   
Reply With Quote
Darn
Old
DrJim
Guest
 
Status:
Posts: n/a
Angry Darn - 11-05-2006, 04:57 PM

Think what I suggested "would have worked if" - ah, wonderful words - the center of the magnet object had been where I thought it was instead of where it actually is (darn reality, even the virtual type). Consider instead a torus with the center truly in the middle of the ring. Now the case you show will not count as a ringer since the center of the torus is more than a radius away from the wand (pole).

If you want to actually orient the opening so the horseshoe won't go through the pole when tossed, you do need to do more, of course - or you could just change the name of the game to "Ring Toss."
Attached Images
File Type: jpg ringer_2.JPG (7.2 KB, 95 views)
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.