Qbasicnews.com
July 20, 2019, 11:45:11 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Project SET  (Read 6564 times)
Tia
Member
*
Posts: 37


« on: November 24, 2007, 06:00:51 PM »

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 :/

Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #1 on: November 25, 2007, 12:42:48 AM »

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
« Last Edit: November 26, 2007, 10:05:49 PM by Mac » Logged
Tia
Member
*
Posts: 37


« Reply #2 on: November 25, 2007, 02:01:40 PM »

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.
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #3 on: November 26, 2007, 04:32:09 PM »

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
Logged
Tia
Member
*
Posts: 37


« Reply #4 on: November 26, 2007, 05:24:42 PM »

That was really helpful thank you so much ill get back if i have any other questions.  Thanks a lot once again.
Logged
Tia
Member
*
Posts: 37


« Reply #5 on: December 02, 2007, 09:39:53 PM »

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.
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #6 on: December 02, 2007, 10:48:53 PM »

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/message/1192127960

Mac


Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #7 on: December 02, 2007, 10:55:56 PM »

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/message/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
Logged
Tia
Member
*
Posts: 37


« Reply #8 on: December 03, 2007, 12:29:16 AM »

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.
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #9 on: December 05, 2007, 11:54:52 AM »

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/message/1196864548

Mac
Logged
Tia
Member
*
Posts: 37


« Reply #10 on: December 05, 2007, 06:37:56 PM »

btw I am a male I just chose the first three letters of my first WoW character as a name.  And I got a 72 on the project with just a menu and instructions oh how to play lol I may or may not chose to finish it later.
Logged
Mac
Senior Member
**
Posts: 243


WWW
« Reply #11 on: December 05, 2007, 07:16:37 PM »

72 = Good!

If you broke your back for 72 straight hours, you might have obtained 83. Not worth the effort. Budget time to other subjects (and babes).

Idea: Stick a note on your professors door asking him/her to grade the final game we came up with. LOL.

Mac
Logged
Tia
Member
*
Posts: 37


« Reply #12 on: December 08, 2007, 06:07:48 PM »

not a bad idea and can give it to my teacher (i am still in High school)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!