Code Mafia: Interest Gauge.

This forum is for discussion related to the game.
User avatar
Frozen Angel
Frozen Angel
She
Queen Shifty
User avatar
User avatar
Frozen Angel
She
Queen Shifty
Queen Shifty
Posts: 18753
Joined: October 26, 2015
Pronoun: She

Post Post #50 (ISO) » Thu Apr 21, 2016 3:08 am

Post by Frozen Angel »

Lets not get satisfied with Python :) this is java

Code: Select all

static public int diffrenseMinMax ( int[] input){
     int min = input[0];
     int max = input[0];
     for(int i=1;i< input.length;i++){
          if(input[i]<min) min = input[i];
          if(input[i]>max) max = input[i];
     }
     return max-min;
}
False tears bring pain to those around you
False smile brings pain to one's self


"Frozen Like Your Heart." -Ginngie
User avatar
Frozen Angel
Frozen Angel
She
Queen Shifty
User avatar
User avatar
Frozen Angel
She
Queen Shifty
Queen Shifty
Posts: 18753
Joined: October 26, 2015
Pronoun: She

Post Post #51 (ISO) » Thu Apr 21, 2016 3:09 am

Post by Frozen Angel »

In post 47, Thestatusquo wrote:I don't think continuing to post and answer code challenges is really consistent with the purpose of this thread or the forum its in, though.

Probably should make a new thread somewhere if you want to keep doing that.


ok
False tears bring pain to those around you
False smile brings pain to one's self


"Frozen Like Your Heart." -Ginngie
User avatar
Frozen Angel
Frozen Angel
She
Queen Shifty
User avatar
User avatar
Frozen Angel
She
Queen Shifty
Queen Shifty
Posts: 18753
Joined: October 26, 2015
Pronoun: She

Post Post #52 (ISO) » Thu Apr 21, 2016 3:11 am

Post by Frozen Angel »

I'm up for code challenges if there is going to be more. Just take it to the next level please ! I can post crazy challenges myself. we may start a mish mash section for just challenges ?
False tears bring pain to those around you
False smile brings pain to one's self


"Frozen Like Your Heart." -Ginngie
User avatar
Accountant
Accountant
Jack of All Trades
User avatar
User avatar
Accountant
Jack of All Trades
Jack of All Trades
Posts: 6419
Joined: May 16, 2015
Location: Wonderland

Post Post #53 (ISO) » Thu Apr 21, 2016 3:16 am

Post by Accountant »

I want a mish mash coding challenge
There's nothing that says that a fake can't beat the real thing.

You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
User avatar
Accountant
Accountant
Jack of All Trades
User avatar
User avatar
Accountant
Jack of All Trades
Jack of All Trades
Posts: 6419
Joined: May 16, 2015
Location: Wonderland

Post Post #54 (ISO) » Thu Apr 21, 2016 3:16 am

Post by Accountant »

If TSQ wont post it then I will
There's nothing that says that a fake can't beat the real thing.

You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #55 (ISO) » Fri Apr 22, 2016 7:44 am

Post by Flubbernugget »

Same
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #56 (ISO) » Fri Apr 22, 2016 8:37 am

Post by Flubbernugget »

I JUST PUT A CODING THREAD IN MISH MASH PLEASE GIVE ME PROBLEMS AND ANSWER THE ONES I POSTED :)
User avatar
Accountant
Accountant
Jack of All Trades
User avatar
User avatar
Accountant
Jack of All Trades
Jack of All Trades
Posts: 6419
Joined: May 16, 2015
Location: Wonderland

Post Post #57 (ISO) » Fri Apr 22, 2016 3:57 pm

Post by Accountant »

rip
There's nothing that says that a fake can't beat the real thing.

You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #58 (ISO) » Sat Apr 23, 2016 7:33 am

Post by chamber »

Code: Select all

$message = "[put message here]";
$arraymessage = explode(")", $message);
echo (strlen($message)-(2*(sizeOf($arraymessage)-1))); 


Was what I did for this a couple days ago. (It's a really silly way of doing it but I was in a silly mood)
Taking a break from the site.
User avatar
Kison
Kison
.GIFted
User avatar
User avatar
Kison
.GIFted
.GIFted
Posts: 6714
Joined: January 22, 2007

Post Post #59 (ISO) » Sun Apr 24, 2016 3:22 pm

Post by Kison »

My first instinct was not even to write any code. Using a half decent text processor and Chrome, both things I always have open, you can solve this in like 10 seconds. Copy message. Open tab. Paste. Search "(", write down occurrences. Search ")", write down occurrences. Paste into Chrome address bar(defaults to Google, which acts as a calculator).

Spoiler:
Image

You get the answer without wasting any brainpower.

Do you think this would work, or do you think the pool of potential players is too small?

I'm sure you could find enough people to participate.
Especially interested in knowing if this is something you personally would like.

Sounds fun to me. Whether I'd have time is a whole different question. :?
DeathRowKitty
DeathRowKitty
she
Frog
DeathRowKitty
she
Frog
Frog
Posts: 6296
Joined: June 7, 2009
Pronoun: she

Post Post #60 (ISO) » Mon Apr 25, 2016 6:30 pm

Post by DeathRowKitty »

Code: Select all

,[>+++++[-<-------->]<[>>--<<-]>>+<<,]>>[->>+---------->+<[++++++++++[-<+>]>-<]<[->+<]<]>>[>]<[>++++++++[-<++++++>]<.[-]<]


I made some completely unjustified simplifying assumptions (answer no more than 2 digits and not a multiple of 10) in order to avoid spending too long on this, but it works.
User avatar
Accountant
Accountant
Jack of All Trades
User avatar
User avatar
Accountant
Jack of All Trades
Jack of All Trades
Posts: 6419
Joined: May 16, 2015
Location: Wonderland

Post Post #61 (ISO) » Mon Apr 25, 2016 8:27 pm

Post by Accountant »

That's some ugly ass code
There's nothing that says that a fake can't beat the real thing.

You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
zakk
zakk
Jack of All Trades
zakk
Jack of All Trades
Jack of All Trades
Posts: 6235
Joined: September 1, 2013

Post Post #62 (ISO) » Mon Apr 25, 2016 10:10 pm

Post by zakk »

In post 59, Kison wrote:My first instinct was not even to write any code. Using a half decent text processor and Chrome, both things I always have open, you can solve this in like 10 seconds. Copy message. Open tab. Paste. Search "(", write down occurrences. Search ")", write down occurrences. Paste into Chrome address bar(defaults to Google, which acts as a calculator).

Spoiler:
Image

You get the answer without wasting any brainpower.

Do you think this would work, or do you think the pool of potential players is too small?

I'm sure you could find enough people to participate.
Especially interested in knowing if this is something you personally would like.

Sounds fun to me. Whether I'd have time is a whole different question. :?

ha. exactly what i did. sublime and google :lol:

and i don't think i'd have time either :cry: :?

In post 44, Accountant wrote:
Given an array length 1 or more of ints, return the difference between the largest and smallest values in the array.

Bonus points: don't use min() or max()

for array
x
:

Code: Select all

function y(a,b){return a-b}x.sort(y);z=x[x.length-1]-x[0]

No need to write a ton of code for this

the answer is
z
(obviously)
permanently retired

see here for more info
User avatar
BBmolla
BBmolla
Open Book
User avatar
User avatar
BBmolla
Open Book
Open Book
Posts: 24301
Joined: May 29, 2011

Post Post #63 (ISO) » Wed Apr 27, 2016 1:36 pm

Post by BBmolla »

In post 30, Thestatusquo wrote:If someone wants to do it as a mish mash game they can feel free. I don't understand why that would have to be an either or proposition. Like, the fact that we have mish mash survivor games does not preclude us from having survivor themed mafia games.

Because it inherently would give advantage to those who are better at coding as opposed to those who are good at mafia. And depending on game design that would indicate that in some way the game can be won/loss by who gets the better programmers.

That's my two cents.
Come see me in the Great American Melodrama in Oceano
User avatar
Frozen Angel
Frozen Angel
She
Queen Shifty
User avatar
User avatar
Frozen Angel
She
Queen Shifty
Queen Shifty
Posts: 18753
Joined: October 26, 2015
Pronoun: She

Post Post #64 (ISO) » Wed Apr 27, 2016 2:10 pm

Post by Frozen Angel »

In post 62, zakk wrote:No need to write a ton of code for this


The question wants an optimized way to find it - not using a pre programmed sort function for finding min / max. using the original min max function was better than that from this perspective.
False tears bring pain to those around you
False smile brings pain to one's self


"Frozen Like Your Heart." -Ginngie
User avatar
Ircher
Ircher
He / Him / His
What A Grand Idea
User avatar
User avatar
Ircher
He / Him / His
What A Grand Idea
What A Grand Idea
Posts: 15170
Joined: November 9, 2015
Pronoun: He / Him / His
Location: CST/CDT

Post Post #65 (ISO) » Wed Apr 27, 2016 2:17 pm

Post by Ircher »

Wouldn't it take O(N) time?

Code: Select all

#include <stdlib.h>
#include <stdio.h>

int main() {
  int arr[n] = {}; // C11 feature; put comma-separated list in brackets. n represents number of items in array
  int highest = -(1 << 31); / Something like that
  int lowest = 1 << 31; // Again something like that
  int i = 0;
  for (; i < n; ++i) {
    if (arr[i] > highest) highest = arr[i];
    if (arr[i] < lowest) lowest = arr[i];
  }
  printf( "The range of the datalist is %i", highest - lowest );
  return 0;
}
Links: User Page | GTKAS
Do you have questions, ideas, or feedback for the Scummies? Please pm me!
Hosting: The Grand Neighborhood [In Signups: 7/9]
User avatar
Frozen Angel
Frozen Angel
She
Queen Shifty
User avatar
User avatar
Frozen Angel
She
Queen Shifty
Queen Shifty
Posts: 18753
Joined: October 26, 2015
Pronoun: She

Post Post #66 (ISO) » Wed Apr 27, 2016 2:26 pm

Post by Frozen Angel »

Thats what the rest of us did yeah (and there is a better way for your starting point (see my code up there for example)
False tears bring pain to those around you
False smile brings pain to one's self


"Frozen Like Your Heart." -Ginngie
User avatar
Ircher
Ircher
He / Him / His
What A Grand Idea
User avatar
User avatar
Ircher
He / Him / His
What A Grand Idea
What A Grand Idea
Posts: 15170
Joined: November 9, 2015
Pronoun: He / Him / His
Location: CST/CDT

Post Post #67 (ISO) » Wed Apr 27, 2016 2:32 pm

Post by Ircher »

It's written in C.

I could move it all to another function, but I would still need the length to be provided manually.
Links: User Page | GTKAS
Do you have questions, ideas, or feedback for the Scummies? Please pm me!
Hosting: The Grand Neighborhood [In Signups: 7/9]
Post Reply

Return to “Mafia Discussion”