In development: ROBOMOD

This forum is for discussion related to the game.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

In development: ROBOMOD

Post Post #0 (isolation #0) » Thu Apr 09, 2015 10:32 am

Post by vonflare »

Have you ever wanted to play a nice little game of mafia, but you only have 4 friends? With 5 people, thats 4 players and a mod. But what good setup uses only 4 players? 5 is where its at. If only there was a way to play so that there is no mod, and yet all night actions and win conditions are handled fairly. Well, now there is!

Sales pitch aside, I'm coding a computer program that will act as 'the mod' for a meatworld game with the setup Lyncher Mafia, with the additional variable of 50% chance that the lyncher is a jester (dosen't end the game) (I'm planning on adding more setups eventually)

Basically, the program will call in the players individually and tell them their roles. Then, during the day, it will wait patiently as the players come to a decision as to who to lynch. It will flip them, then call in the players one at a time to submit their night actions. If they dont have a night action, they will just type their own name. It will detect when a player has fulfuilled their win condition too!

I'm coding it in Eclipse, and a prototype should be ready within a few weeks.

Just wanted to share. Thoughts?
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #2 (isolation #1) » Thu Apr 09, 2015 11:23 am

Post by vonflare »

Yeah, I saw that (I read every mini in trying to decide which setup to create) but I thought lyncher/jester would be more fun.

And I'm trying to decide whether to do that one or dethy next.
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #4 (isolation #2) » Thu Apr 09, 2015 11:37 am

Post by vonflare »

Hmm true.

I'll probably do dethy next.
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #10 (isolation #3) » Fri Apr 10, 2015 12:56 am

Post by vonflare »

Yeah, that was the idea. But for dethy especially, you need a mod. I don't see any way around it. That was the original inspiration (dethy) but I decided to test the concept with an easier setup first.

The way I distribute the roles seems inefficient to me. Because you can't have repeats, you can't just assign each player a random role.

Here's my code for the role assignments:

Spoiler:
import java.util.*;


public class ExeModless {

static String p1R = "";
static String p2R = "";
static String p3R = "";
static String p4R = "";
static String p5R = "";

public static void main (String [] args) {
///////////////////////////////////////////////////////////////////////////////////
Random r = new Random();
Scanner s = new Scanner(System.in);
int p1RP = r.nextInt(5)+1;
int p2RP = r.nextInt(5)+1;
int p3RP = r.nextInt(5)+1;
int p4RP = r.nextInt(5)+1;
int p5RP = r.nextInt(5)+1;

int EorJ = r.nextInt(2);

boolean repeat = true;

while (repeat)
{
if (p1RP == p2RP || p1RP == p3RP || p1RP == p4RP || p1RP == p5RP) {p1RP=r.nextInt(5)+1;}
else if (p2RP == p3RP || p2RP == p4RP || p2RP == p5RP) {p2RP=r.nextInt(5)+1;}
else if (p3RP == p4RP || p3RP == p5RP) {p3RP=r.nextInt(5)+1;}
else if (p4RP == p5RP) {p4RP=r.nextInt(5)+1;}
else {repeat=false;}
}

if (p1RP==1) {p1R="villan";}
else if (p1RP==2) {if (EorJ==0) {p1R="executioner";}else if (EorJ==1){p1R="jester";}}
else if (p1RP==3) {if (EorJ==0) {p1R="target";}else if (EorJ==1){p1R="townie";}}
else {p1R="townie";}

if (p2RP==1) {p2R="villan";}
else if (p2RP==2) {if (EorJ==0) {p2R="executioner";}else if (EorJ==1){p2R="jester";}}
else if (p2RP==3) {if (EorJ==0) {p2R="target";}else if (EorJ==1){p2R="townie";}}
else {p2R="townie";}

if (p3RP==1) {p3R="villan";}
else if (p3RP==2) {if (EorJ==0) {p3R="executioner";}else if (EorJ==1){p3R="jester";}}
else if (p3RP==3) {if (EorJ==0) {p3R="target";}else if (EorJ==1){p3R="townie";}}
else {p3R="townie";}

if (p4RP==1) {p4R="villan";}
else if (p4RP==2) {if (EorJ==0) {p4R="executioner";}else if (EorJ==1){p4R="jester";}}
else if (p4RP==3) {if (EorJ==0) {p4R="target";}else if (EorJ==1){p4R="townie";}}
else {p4R="townie";}

if (p5RP==1) {p5R="villan";}
else if (p5RP==2) {if (EorJ==0) {p5R="executioner";}else if (EorJ==1){p5R="jester";}}
else if (p5RP==3) {if (EorJ==0) {p5R="target";}else if (EorJ==1){p5R="townie";}}
else {p5R="townie";}


Anyone have any suggestions on how to make it more efficient? Some sort of reverse bubble sort? I mean, the above works, it just has to do a lot of Random.nextInt.

(And before you suggest arrays, Im planning on making the players into arrays instead of individual variables eventually. This is just a proof of concept)

PS: in the code, villan = mafioso, executioner = lyncher, target = unaware lynchee
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #13 (isolation #4) » Fri Apr 10, 2015 1:27 am

Post by vonflare »



Yeah, I've played the supersaint setup in RL, but it dosent really require a mod because there isn't any night actions. Ace of spades = mafia, jack of diamonds = vengeful, 2 of hearts = townie

The cop setup is interesting, though.

In post 11, Aeronaut wrote:This is how the matrix starts



I loled
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #16 (isolation #5) » Fri Apr 10, 2015 2:25 am

Post by vonflare »

XYLBOT?
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #19 (isolation #6) » Fri Apr 10, 2015 3:04 am

Post by vonflare »

See, that's where I'm stuck. I'm not sure how to use 'shuffle'. I looked it up and the answers were not helpful.

Pedit: @magua
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #21 (isolation #7) » Fri Apr 10, 2015 3:20 am

Post by vonflare »

I looked XYLBOT up. How do I join a game of that?
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #26 (isolation #8) » Fri Apr 10, 2015 2:26 pm

Post by vonflare »

What do you mean?
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #28 (isolation #9) » Sat Apr 11, 2015 4:43 am

Post by vonflare »

In post 23, Magua wrote:
In post 19, vonflare wrote:See, that's where I'm stuck. I'm not sure how to use 'shuffle'. I looked it up and the answers were not helpful.

Pedit: @magua


Java's not my thing, but something like this:

Code: Select all

List<String> roles = Arrays.asList("VT", "VT", "Lynchee", "Mafia", "Lyncher");
Collections.shuffle(roles);


roles.get(0) will be the role of the first player, roles.get(1) will be the role of the second player, etc.

If you want the Mafia to be a possible Lynchee, get a random number 0-4 afterwards, rerolling while "Lyncher".equals(roles.get(yournumber))


Hey, this worked great! I had to modify the code a bit though, List apperently dosen't take parameters.

Code: Select all

import java.awt.List;
import java.util.Arrays;
import java.util.Collections;


public class test {

@SuppressWarnings("unchecked")
public static void main (String [] args) {
	
	java.util.List<?> roles = (java.util.List<?>) Arrays.asList("VT", "VT", "Lynchee", "Mafia", "Lyncher");
	Collections.shuffle(roles);
	
	System.out.println(((java.util.List<String>) roles).get(0));
	System.out.println(((java.util.List<String>) roles).get(1));
	System.out.println(((java.util.List<String>) roles).get(2));
	System.out.println(((java.util.List<String>) roles).get(3));
	System.out.println(((java.util.List<String>) roles).get(4));
	
}
	
}



produces the correct results.

thanks again!
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
User avatar
vonflare
vonflare
doot
User avatar
User avatar
vonflare
doot
doot
Posts: 3093
Joined: January 1, 2014
Location: Blue Gatorade Factory

Post Post #31 (isolation #10) » Sat Apr 11, 2015 4:57 am

Post by vonflare »

In post 30, Magua wrote:Import java.util.list instead of java.awt.list and use string rather than ? gets rid of all the unnevessary casts


Ohey, you're right!

My mistake was I didnt import Java.*;, I just used the reccomended import, which was Java.awt.list;.

This works now:

Code: Select all

import java.util.*;

public class test {
	
	static Random r = new Random();
	static Scanner s = new Scanner(System.in);
	
	static int EorJ = r.nextInt(2);
	
	static String [] Name = new String[5];
	static String [] Role = new String[5];
	

@SuppressWarnings("unchecked")
public static void main (String [] args) {
	
	List<String> roles = Arrays.asList("Townie", "Townie", "Target", "Executioner", "Villan");
	
	if (EorJ==1) {roles = Arrays.asList("Townie", "Townie", "Townie", "Jester", "Villan");}
	
	Collections.shuffle(roles);
	
	for (int i=0; i<5; i++) {
		Role[i]=roles.get(i);
		}
	}
	
}
THIS POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

Return to “Mafia Discussion”