Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!

Join the forum, it's quick and easy

Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com

non-duplicate random number generation

4 posters

Go down

non-duplicate random number generation Empty non-duplicate random number generation

Post by GoldenBeastStudios Thu Sep 10, 2009 11:32 pm

The topic title is a mouthful, but accurate lol. I have a game I'm tinkering with titled Froggo (at least it's called that for now) it involves the play area having random numbers from 1-75 on 24 different tiles. You can play the prototype on yoyo here To get the numbers on the tiles, I put in the tile object creation event:

number=floor(random(74))+1

Using the floor command gets rid of any decimals, but I'm running into a problem with duplicate number (ie number 25 on 6 different tiles). The ideal is to have no duplicate numbers on any of the tiles. I know putting the code in the create event probably isn't the smartest way to go about it, but I'm just not sure how create the desired result. Any pointers?

Regards,

John,
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Fri Sep 11, 2009 4:14 pm

can you give more actions for it like if there was something in the draw event
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Fri Sep 11, 2009 4:25 pm

What I'm missing is a way to determine when there's duplicates, and then take some sort of action to correct it... or something Razz I'm suspecting I need something in the room create code, I just can't quite wrap my mind around what I would need to meet my desired result :p Thanks all the same though! Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Fri Sep 11, 2009 4:45 pm

maybe something like this

room code
Code:
global.empty=0

then on your event put it in the step event

Code:
if global.empty=0
{
number=floor(random(74))+1
global.empty=1
}

then try that if that does not work you might have to make different varibles and objects for each square
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Fri Sep 11, 2009 4:48 pm

lol, we were both thinking along the same lines Razz I think something like this might do it Razz I'm going to try it out Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Fri Sep 11, 2009 4:50 pm

Hey! were'd my last message go!?! I had a bunch of code writting out similar to what you have, and now it's gone! >:c anyway, I'm going to try it out Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Fri Sep 11, 2009 4:51 pm

k
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Fri Sep 11, 2009 5:16 pm

Ug, it didn't really work out, even if I set up global variables to account for the numbers, I don't know how to make the object "reset" to try again. Even if I could, in theory, it could go on forever until it reaches a untaken number. I'm stumped Sad
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Fri Sep 11, 2009 5:24 pm

no i meant like
on the second on

room create
Code:
global.squareone=0
global.squaretwo=0
//ect.

step

on sqaure one

Code:
if global.squareone=0
{
number=floor(random(74))+1
global.empty=1
}

and same for the rest of square accept on square two the varible would be global.squaretwo ect..
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Fri Sep 11, 2009 7:11 pm

Sorry, I don't get it Razz How would that prevent duplicate numbers? Thank you for helping! I'm not smart lol Razz
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by fooey Fri Sep 11, 2009 7:17 pm

... wow...
fooey
fooey
Moderator
Moderator

Posts : 1422
Points : 55590
GameML Reputation : 1
Join date : 2009-07-10
Age : 29
Location : here

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Sat Sep 26, 2009 2:10 pm

This topic is still open! i can't figure it out Razz Thanks to all who have replied Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Sat Sep 26, 2009 4:31 pm

could you like give me a gmk whith just the blocks with the numbers in it
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Sat Sep 26, 2009 4:33 pm

I could do a quick mock-up, I'll make it asap Smile thanks!
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Sat Sep 26, 2009 4:36 pm

i will probally finnish it on monday if don't get on the computer
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Sat Sep 26, 2009 4:47 pm

Posted a GMK on our SkyDrive to help clarify the problem, you can find it here:

http://cid-938ebb7f49a5a4e7.skydrive.live.com/self.aspx/tile^_number/tile^_numbers.gmk

(The Skydrive link is acting weird, just copy & paste this link into your browser)

Thanks to all who reply Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Sat Sep 26, 2009 5:14 pm

k
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by -js1210- Sat Sep 26, 2009 6:26 pm

Well you could just do the really hard thing to do and make like 50 individual tiles. And then if the number of two(or more) tiles is the same all the tiles get new numbers.
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56572
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Sat Sep 26, 2009 6:50 pm

One thing I'm trying to avoid is having the numbers change after the object is created (although if I can't figure out a way to do that, I guess I'll have to live with it Razz) That idea isn't bad though, I'll have to keep kicking around that idea Razz I didn't know this would be so hard Razz

Thanks for your help!

John,
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by -js1210- Sat Sep 26, 2009 7:05 pm

-js1210- wrote:Well you could just do the really hard thing to do and make like 50 individual tiles. And then if the number of two(or more) tiles is the same all the tiles get new numbers.

Just to let you know I meant only the tiles that have the same numbers.
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56572
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by GoldenBeastStudios Sun Sep 27, 2009 6:53 pm

Fixed the problem using a ds_list! Thanks for helping everyone! Smile
GoldenBeastStudios
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 54264
GameML Reputation : 2
Join date : 2009-07-09
Age : 41
Location : Austin, Texas

http://www.goldenbeaststudios.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by The Dark Ninja Mon Sep 28, 2009 8:27 pm

your welcome
The Dark Ninja
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 56984
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

http://www.thedakninja.tastyhamgames.com

Back to top Go down

non-duplicate random number generation Empty Re: non-duplicate random number generation

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum