Code Mafia: Interest Gauge.

This forum is for discussion related to the game.
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #25 (ISO) » Wed Apr 20, 2016 3:20 am

Post by Thestatusquo »

In post 18, Kagami wrote:
In post 16, Psyche wrote:oh, so you're not asking for people's code


Asking for code is absurd if the challenge is intended to be code-agnostic.

I think I'd be more interested as a mish mash. It seems like you'd have to be very meticulous about how challenges are assigned (i.e. determine
everything
pregame) to avoid problems with mod intervention, and the game is going to suffer if some players will easily complete all the challenges, while others will complete relatively few.


I will be don't worry. Everything is scripted pre game.

The second thing is why I want people who already have some idea how to code. I would not recommend this game if you're just like "eh, I can probably figure out some code stuff"
tout comprendre c'est tout pardonner
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #26 (ISO) » Wed Apr 20, 2016 3:32 am

Post by Psyche »

hehehe
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #27 (ISO) » Wed Apr 20, 2016 3:36 am

Post by Thestatusquo »

I think given this reaction I'll probably put in the work to run it.

If it doesn't fire it doesn't fire.
tout comprendre c'est tout pardonner
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #28 (ISO) » Wed Apr 20, 2016 11:56 am

Post by Flubbernugget »

In post 23, Psyche wrote:i used a for loop with a nested if/else
unless count runs in less than linear time i think it might have taken half as much time to run as yours
but it didnt fit in one line

I know in f# the compuler/interpreter can convert tail recursion to iteration for the object code

Is this a thing for Python?
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #29 (ISO) » Wed Apr 20, 2016 11:59 am

Post by Flubbernugget »

Also I would do this as a mafia game but would much rather do it as a Mish mash game
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #30 (ISO) » Wed Apr 20, 2016 12:54 pm

Post by Thestatusquo »

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.
tout comprendre c'est tout pardonner
User avatar
Flubbernugget
Flubbernugget
Survivor
User avatar
User avatar
Flubbernugget
Survivor
Survivor
Posts: 11751
Joined: June 26, 2014

Post Post #31 (ISO) » Wed Apr 20, 2016 1:20 pm

Post by Flubbernugget »

I actually started thinking ideas to post in Mish Mash but I didn't want to undermine your efforts by causing supply/demand issues.
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #32 (ISO) » Wed Apr 20, 2016 6:42 pm

Post by Thestatusquo »

Have no problems with a mish mash code game!

that sounds awesome. I'd likely play in it.
tout comprendre c'est tout pardonner
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 #33 (ISO) » Wed Apr 20, 2016 7:04 pm

Post by Accountant »

My attempt at the parenthesis problem(written in Python)

Code: Select all

def main(code):
    for all element in code:
        floor = 0
        if element = "(":
            floor += 1
        elsif element = ")":
            floor -= 1
        else:
             print "Invalid character! \n"
        return floor

print main(*)

* indicates where you should copypaste the encoded text.
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
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #34 (ISO) » Wed Apr 20, 2016 7:14 pm

Post by Psyche »

i used "is" because "is" is a word
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
User avatar
Kagami
Kagami
Jack of All Trades
User avatar
User avatar
Kagami
Jack of All Trades
Jack of All Trades
Posts: 7065
Joined: November 5, 2013

Post Post #35 (ISO) » Thu Apr 21, 2016 2:11 am

Post by Kagami »

In post 33, Accountant wrote:My attempt at the parenthesis problem(written in Python)

Code: Select all

def main(code):
    for all element in code:
        floor = 0
        if element = "(":
            floor += 1
        elsif element = ")":
            floor -= 1
        else:
             print "Invalid character! \n"
        return floor

print main(*)

* indicates where you should copypaste the encoded text.


Put "floor = 0" outside of the loop. Your use of "=" over "is" is correct here, since "is" is much more likely to introduce a bug later on if you end up building on this code to handle similar problems.
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #36 (ISO) » Thu Apr 21, 2016 2:22 am

Post by Psyche »

"return floor" also needs to be outside the loop
Last edited by Psyche on Thu Apr 21, 2016 2:23 am, edited 1 time in total.
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
User avatar
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #37 (ISO) » Thu Apr 21, 2016 2:23 am

Post by Thestatusquo »

is there no difference between variable assignment and conditional checks in python?

that's weird. Most languages I've worked in use = vs == or something similar to differentiate the two.
tout comprendre c'est tout pardonner
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #38 (ISO) » Thu Apr 21, 2016 2:24 am

Post by Psyche »

i was going to ask that, too
when i'm coding in python, i've always used == and i thought it was because i had to
similarly, i thought i had to use the form "for <dummyvariable> in <list>", which contrasts with accountant's including "all" in there
but syntax is less important that the algorithm itself
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
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 #39 (ISO) » Thu Apr 21, 2016 2:37 am

Post by Frozen Angel »

I'm not a Python developer but I think it must be "=="

and "is" is not equality checker. its identity checker like ".equals()" in java.

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


"Frozen Like Your Heart." -Ginngie
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #40 (ISO) » Thu Apr 21, 2016 2:41 am

Post by Psyche »

"is" works, though! and it's english!
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
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 #41 (ISO) » Thu Apr 21, 2016 2:50 am

Post by Accountant »

In my defense i wrote the damn thing on mobile while waiting for my lecture to begin.

Kagami is correct, floor = 0 has to be outside the loop. TSQ and FA are correct, it has to be ==.

No idea about is but I prefer ==
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
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #42 (ISO) » Thu Apr 21, 2016 2:52 am

Post by Thestatusquo »

Code: Select all


a = 19998989890
b = 19998989889 +1
>>> a is b
False
>>> a == b
True


There's a reason different operators exist. The reason it works for you is you haven't come across the edge cases yet, I would imagine.
tout comprendre c'est tout pardonner
User avatar
Psyche
Psyche
he/they
Survivor
User avatar
User avatar
Psyche
he/they
Survivor
Survivor
Posts: 10048
Joined: April 28, 2011
Pronoun: he/they

Post Post #43 (ISO) » Thu Apr 21, 2016 2:53 am

Post by Psyche »

no way i use it all the time
but when i can? yeahhh
youtube playlist extracter | donbot | game scraper | vca | setupsim | strategist | llm
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 #44 (ISO) » Thu Apr 21, 2016 2:54 am

Post by Accountant »

Shamelessly stolen from the internet

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()
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 #45 (ISO) » Thu Apr 21, 2016 2:54 am

Post by Accountant »

Clarification: Answer above should be written as a defined function, called using an array length of one or more in its parameters.
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 #46 (ISO) » Thu Apr 21, 2016 3:01 am

Post by Accountant »

Code: Select all

def find_diff(array)
>largest = 0
>smallest = 0
>>for x in array:
>>>if x > largest:
>>>>largest = x
>>>elseif x < smallest:
>>>>smallest = x
>>>else:
>>>>print "You fucked up! Try again!"

>return largest - smallest

Another attempt at coding on mobile. Using > because tapping space four times messes with my head.
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
Thestatusquo
Thestatusquo
He/Him
Shea

User avatar
User avatar
Thestatusquo
He/Him
Shea

Shea

Posts: 14362
Joined: July 27, 2006
Pronoun: He/Him
Location: Chicago!

Post Post #47 (ISO) » Thu Apr 21, 2016 3:03 am

Post by Thestatusquo »

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.
tout comprendre c'est tout pardonner
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 #48 (ISO) » Thu Apr 21, 2016 3:04 am

Post by Ircher »

Code: Select all

#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
  if (argc != 2) return 1; // 2nd argument is the encrypted code
  unsigned int i = 0;
  unsigned int length = strlen(argv[1]) + 1;
  int floor = 0;
  for (; i < length - 1; ++i) { //< -1 cuz of null-terminator
    if (argv[1][i] == '(') floor += 1;
    else if (argv[1][i] == ')') floor -= 1;
    else {
      printf( "Invalid character at %u!\n", i );
      return 1;
    }
  }
  printf( "The floor is %i!\n", floor );
  return 0;
}

There's code in C.
Links: User Page | GTKAS | Ratings
Do you have questions, ideas, or feedback for the Scummies? Please pm me!
Hosting: The Grand Neighborhood [In Signups: 6/9]
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 #49 (ISO) » Thu Apr 21, 2016 3:05 am

Post by Ircher »

That was for the previous
Links: User Page | GTKAS | Ratings
Do you have questions, ideas, or feedback for the Scummies? Please pm me!
Hosting: The Grand Neighborhood [In Signups: 6/9]
Post Reply

Return to “Mafia Discussion”