Java: LOL!: Gamification of a DataSET :D

Randomized multiple choice quiz of the relationship sets of Fallout 2 Characters and their Locations.

(Character (is from/is related to) Location)
(Concept 1 -> Relationship -> Concept 2)
( Sulik from Klamath)

Now we want to ask a random question, so we get a random number between 1 and 13 , and pick that row in the data set.

We roll the dice and get “1” so we take the first data row and ask

“Where is Sulik Found?”

This quiz is going to be multiple choice of 4, so we need 3 random incorrect answers, and we need to randomize the correct answer’s location somewhere within the set of incorrect answers.

Make a List of 3 unique/distinct incorrect answers out of the remaining values within the hashtable.  Again, exclude the correct answer  and handle any duplicates.  So in Sulik‘s case, the distinct set of potential incorrect answers looks like this.

Pick another random number and pick 3 distinct values from this list.  Then, append the 3 incorrect values with the correct one.  Pick another random random number 1-4 and display the randomized answers 4 times for “a.)” through “d.)“.

code for now…

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Random;
public class QuizStructure
	public static void main(String[] args)
		LinkedList EveryPotentialQuestion_AnswerSet = new LinkedList();
		//HOW TO MAKE A Randomized QUIZ off OF a DataSet
		//Gamification of a DataSET// LOL :D
		Hashtable Character_to_Location = new Hashtable();
		//"FALLOUT 2 Black Isle Character to Location" Relationship//
		//( Character - Is_From - Location )//
		//( Concept - Relationship - Concept )
		Character_to_Location.put("Sulik", "Klamath");
		Character_to_Location.put("Vic", "Den");
		Character_to_Location.put("Miria", "Modoc");
		Character_to_Location.put("Davin", "Modoc");
		Character_to_Location.put("Cassidy", "Vault City");
		Character_to_Location.put("Lenny", "Gecko");
		Character_to_Location.put("Marcus", "Broken Hills");
		Character_to_Location.put("Myron", "New Reno Stables");
		Character_to_Location.put("Skynet Robot", "Sierra Army Depot");
	        Character_to_Location.put("K-9", "Navarro");
		Character_to_Location.put("Goris", "Vault 13");
		Character_to_Location.put("Cyber Dog", "NCR");
		Character_to_Location.put("Dogmeat", "Cafe of Broken Dreams");
		Enumeration keys = Character_to_Location.keys();
		while( keys.hasMoreElements() )
			Object key = keys.nextElement();
			Object value = Character_to_Location.get(key);
			System.out.println("Question/Answer Preview:  Where is "+key+" from in Fallout 2?         Answer : "+value);
	    Random randomGenerator = new Random();
	    System.out.println("size: "+Character_to_Location.size());
		//ask Ten randomized questions with 4 randomized answers
for( int i = 0 ; i  < 10 ; i++)
	int randomInt = randomGenerator.nextInt(Character_to_Location.size());
	int iStop = 0;
	Enumeration morekeys = Character_to_Location.keys();
	while( morekeys.hasMoreElements() )
	Object key = morekeys.nextElement();
	Object value = Character_to_Location.get(key);
	if ( iStop == randomInt)
	//System.out.println("index:" + iStop + "    "+randomInt);
	System.out.println("Where is "+key+" from?");
	//Generate Multiple Choice
	//we know the correct answer is
	System.out.println("                   Correct Answer   : " + value);
	//now we need to generate other "incorrect" Choices
	//we need 3, Multiple Choice is Typically 4 questions
	LinkedList wrongAnswerList = new LinkedList();
	//while wrongAnswerList is not unique
	//we want to remove the possibility of duplicates
	//we want to not include correct answer
	boolean is_wronglist_unique = false;
int randomWrong = randomGenerator.nextInt(Character_to_Location.size());
Enumeration wrongkeys = Character_to_Location.keys();
int iStopInner =0;
while( wrongkeys.hasMoreElements() )
Object key2 = wrongkeys.nextElement();
Object value2 = Character_to_Location.get(key2);
if ( iStopInner == randomWrong)
if ( !wrongAnswerList.contains(value2))
if (wrongAnswerList.size() ==3)
{is_wronglist_unique = true;}
	System.out.println("                  Incorrect Answers : "+wrongAnswerList.toString());
	String [] AnswerSet = (String[]) wrongAnswerList.toArray(new String[0]);
	//get 4 random ints :D
	LinkedList numberset = new LinkedList();
	boolean isnumbersetunique = false;
	int deerpCount = 0;
int randomfinal4 = randomGenerator.nextInt(4);
if (!numberset.contains(randomfinal4))
if(deerpCount == 4)
isnumbersetunique = true;
String individualquestion ="";
System.out.println("** FINAL QUESTION ***   Where is "+key+" from?");
 individualquestion += "** FINAL QUESTION ***   Where is "+key+" from?";
ListIterator itr = numberset.listIterator();
String[] abcd = {"a.)","b.)","c.)","d.)"};
int ix = 0;
	int get =(int);
	System.out.println("                        " +abcd[ix]+" "+ AnswerSet[get]);
	individualquestion += "                        " +abcd[ix]+" "+ AnswerSet[get];
if ( !EveryPotentialQuestion_AnswerSet.contains(individualquestion))
	//how do I know when this ^ is full ?????? ???????
	//What is the most optimal way to answer this ^ without doing it manually?
		//the more questions you ask the more answers you'll get

Output Example:

What is the total number of distinct Questions and Possible combinations of Answers?  How many unique questions could be asked? Submit your answers below :D

One thought on “Java: LOL!: Gamification of a DataSET :D

Leave a Reply

Your email address will not be published. Required fields are marked *