Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Algorithm for Pattern game  (Read 1537 times)
0 Members and 1 Guest are viewing this topic.
Offline Kiddo

Senior Newbie





« Posted 2011-03-01 04:11:38 »

Hello everyone,

Question:
    Can anyone direct me to good resources for pattern generation code? (i.e. code that will make patterns for me.)

Details:
    I want to make a pattern recognition game where the player must decide what the next element in the sequence should be. There are two ways, in my mind, to go about this:

    1) construct the patterns myself and implement them. OR
    2) think up an algorithm that I can use to generate the patterns.

    Naturally I prefer the latter but the resources I've found (from google searching and wiki) don't really help me much. If anyone can help me out I would greatly appreciate it
Offline pitbuller
« Reply #1 - Posted 2011-04-02 12:47:31 »

Try doing both. First make dozen pattern yourself and and random element after that. It's easier that way.
Example.
1  
1,2,3,4,5,6,X

Now you can multiply those with any random seed.
Example 2.

1  
1,2,4,8,16,32,X

Now you can multiply this or change the base number.

With that approach I bet you can solve this problem easily.
Offline philfrei
« Reply #2 - Posted 2011-04-09 02:30:01 »

But there are so many different types of sequences!

Here's an idea for generation a simple class of sequences:

Map a set of functions to integers. For example: 1 for +, 2 for -, 3 for *, 4 for /, 5 for mod, etc.

Then, use a random number generator to pick what function or functions and what other integer or integers to use in that function. Maybe even use another random number generator to pick how many functions.

Then, make yourself a simple parser to do the computation.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline N15M0

Senior Newbie





« Reply #3 - Posted 2011-04-18 10:10:43 »

Ey there Smiley

I figured I could help when I attempted to make  a game very similar to this a while back.

If you would like the patterns to be completely randomized, you may create a method(or a few) to generate a pattern by means of a Random generator.

In a simple way, you may create a line to represent your pattern. The game I had was a lame attempt at a 4k game, where 5 circles were shown , and the 6th had to be guessed by the player.

There are 2 main things to take into consideration: how often your pattern will tesselate(or repeat) and how the data is selected to be shown(which colors to show).

By looking into this, you can code yourself a genertor for a random tesselation number and random numbers to represent an image to show.

Understand what I'm getting to?
Hope I helped a bit Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (24 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (55 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!