Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Project SET
#1
Hi im new here but i didn't see an introduction section.  But anyway to the point im doing a project in my comp sci class.  I am doing the game set and i can't figure out a way to make in this case im testing with text, to make the text appear in one one place and when it gets removed to replace it with the new text in a randomized fashion.  I will make an attachment for the code.  If any of you could help it would be very much appreciated.  Also for whatever reason im not very good with arrays :/

Reply
#2
(11-25-2007, 02:00 AM)Tia link Wrote:to make the text appear in one one place and when it gets removed to replace it with the new text in a randomized fashion

Please explain "in a randomized fashion".

You mean the next text should be at some random place on the screen? In that case
locate 1+int(rnd*24),1+int(rnd*(80-len(q$))): print Q$

Right?

Mac
Reply
#3
Actually what i mean is say the board is - 1 2 3 4 5 6 7 8 9 10 11 12 - say 1, 2, and 3 need to be removed because they make a set (ill explain a little later what that means but for now its unnecessary) how would i get the board to place 3 more random numbers (or text) in their place so that the board would be Number number number 4 5 6 7 8 9 10 11 12.  So i wouldn't be moving it i just want it to clear that Number (or text) and replace it with the new Number (or text) in the same position but it would chose the number (or text) randomly.  If that isn't clear enough i can make a Screenshot to show it visually.
Reply
#4
Well, I finally found a description of "Set" at http://www.setgame.com/set/rules_set.htm

Dang! That was hard to find. Never heard of the game, and "set" is a very common word. Might as well have named that game "the" or "is".

Anyway, it appears you have a deck consisting of cards that four attributes and three values for each attribute.

Getting away from all the red/green/squiggle,solid,etc. mumbo-jumble, we can say the cards are
1 1 1 1
1 1 1 2
1 1 1 3
1 1 2 1
1 1 2 2
1 1 2 3
etc. to
3 3 3 2
3 3 3 3
where, for example, 2 1 3 2 would mean Attribute 1 is 2, Attribute 2 is 1, Attribute 3 is 3 and Attribute 4 is 2.

I would imagine your first task is to prepare an array of the 81 cases. For simplicity of array, but complexity of program, you could use
dim a(81) as string * 4
A(1)="1111", A(2)="1112", ..., A(81)="3333".

Now shuffle the array and place values 1-12 on the board. For example, you might get
Code:
1 1121
2 1321
3 2232
4 2211
5 1132
6 3233
7 1112
8 2333
9 1331
10 3212
11 1221
12 2121

(Fancy version would translate the attributes into fancy "cards" and lay them out in a rectangle and use a mouse to identify a set, but that is best left for later. First get the logic of the program going.)

OK, I don't comprehend the game, but presumably those in the know can pick out "sets" of three by some rule. Let's say the following is a "set":
Code:
1 1121
2 1321
11 1221

The player somehow notifies the program that 1, 2, and 11 form a set.

OK, now finally to answer your question:

We go to the array and take the next 3 and use them. So we want to see
Code:
1 2323
2 3332
11 3311
if that were the next three.

So simply use LOCATE to find lines 1,2,11 and replace the display.

Mac
Reply
#5
That was really helpful thank you so much ill get back if i have any other questions.  Thanks a lot once again.
Reply
#6
Ok i have the Array done and im only going to do it in text cause i  really just don't feel like making images for them.  I have decided to use an arrow so the user can use the down and up keys to chose the cards.  But I do not know how to do this If someone can show an example of this I would love you and also How would I say replace the three cards without having a massive amount of code.  Thank you in advance.
Reply
#7
(12-03-2007, 05:39 AM)Tia link Wrote:I have decided to use an arrow so the user can use the down and up keys to chose the cards.  But I do not know how to do this If someone can show an example of this I would love you

Assuming you are female,
http://www.network54.com/Forum/171757/me...1192127960

Mac


Reply
#8
(12-03-2007, 05:39 AM)Tia link Wrote:How would I say replace the three cards without having a massive amount of code.

ROFL! Lot's of Luck!

After your initial post, I got interested in this and did
http://www.network54.com/Forum/202193/me...1196536799

It gives some idea, but it is hard to simply say how to accomplish it.

But the basic idea is "have a massive amount of code".

Given three values were withdrawn from the board because they were said to be a set, you have to distinguish the cases that 1) they were in fact a set, and 2) they were not.

In the latter case, just put them back.

In the former case, deal three new ones (assuming you have any cards left).

But if the cards were extra rows, because the players could not solve with the 12-rows, then you don't deal new ones, but just move existing ones, thereby removing the extra row.

My version allowed up to three extra rows.

Mac
Reply
#9
Thanks for all your help but I have decided to just hand in what I have.  Quite frankly im not even really pursuing a career in computer science anymore so I guess ill try and survive with the Visual Basic Portion of the class which im hella lot better at than QBasic.  Oh and if you are wondering what im going after for a career its Graphic design for games (hence the comp sci)/website development and management (I know HTML and CSS currently trying to learn php and JavaScript on my free time).  But its still fun to know the basis of what im doing also Great job on your version I tested it it is very well done.
Reply
#10
(12-03-2007, 08:29 AM)Tia link Wrote:4I have decided to just hand in what I have. 

Wise. That was a very ambitious project. Too much so.

If you are curious, here is a possible solution
http://www.network54.com/Forum/202193/me...1196864548

Mac
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)