Cooperative Zendo

Not the kind with cardstock and pawns. Mostly play by post Mafia so far.
User avatar
Lambda
Posts: 1021
Joined: Fri Mar 28, 2014 9:39 am
Pronouns: She, her
Contact:

Re: Cooperative Zendo

Post by Lambda »

(Characters other than LRlr have no effect.)
User avatar
DanielH
Posts: 3745
Joined: Tue Apr 01, 2014 1:50 pm
Pronouns: he/him/his

Re: Cooperative Zendo

Post by DanielH »

That is correct. Congratulations!

The planned hint was that the rule was easily extendable beyond just the alphabet, so I am allowing more strings. Now I accept any string of ASCII printable characters which you can convey to me on this forum. That is pretty much anything trivially typable on a standard American keyboard, including space, except counting tab and newlines. If in doubt, anything not shaded red in this chart:
ASCII chart
Image
The actual rule text I used assumed that I would give the hint, and was “All left/right delimeters must be properly nested. Delimeters are the letters l and r (standing for left and right, either case but they must match) in addition to the standard pairs (parentheses, square brackets, and curly braces).”. Your guess is equivalent to my rule on all pre-hint accepted strings, though I had not defined properly nested nearly as thoroughly as you had.

I manually looked at all the inputs and figured out what they should be, but I also double-checked with Python. The relevant definitions are below if anybody is curious:
Python 3

Code: Select all

import locale
locale.setlocale(locale.LC_COLLATE, ('en_US', 'UTF-8'))

def classify(s: str) -> bool:
	stack = []
	delims = {"r": "l",
		  "R": "L",
		  ")": "(",
		  "]": "[",
		  "}": "{"
		  }
	for c in s:
		print("Stack is", stack, "char is", c)
		if c in delims.values():
			stack.append(c)
		elif c in delims.keys():
			if len(stack) == 0 or delims[c] != stack.pop():
				return False
	return not stack

yes = []
no = []

def classifyMany(strings):
	responses = []
	for s in strings:
		if s in yes: responses.append("repeated yes")
		elif s in no: responses.append("repeated no")
		elif classify(s):
			yes.append(s)
			responses.append("yes")
		else:
			no.append(s)
			responses.append("no")
	if all(r.endswith("yes") for r in responses):
		print("All yes")
	if all(r.endswith("no") for r in responses):
		print("All no")
	else:
		print(", ".join(responses))

def printClassifications(sort=True):
	yeses = sorted(yes, key=locale.strxfrm) if sort else yes
	nos = sorted(no, key=locale.strxfrm) if sort else no
	print("[spoiler-box=Koans]")
	print("[b]Yes:[/b]")
	print("[code]", *yeses, "
", sep="\n", end="\n\n")
print("No:")
print("

Code: Select all

", *nos, "
", "
", sep="\n", end="")
[/code][/spoiler-box]
User avatar
Lambda
Posts: 1021
Joined: Fri Mar 28, 2014 9:39 am
Pronouns: She, her
Contact:

Re: Cooperative Zendo

Post by Lambda »

Yay!

Does this mean I get to be the next setter?
User avatar
DanielH
Posts: 3745
Joined: Tue Apr 01, 2014 1:50 pm
Pronouns: he/him/his

Re: Cooperative Zendo

Post by DanielH »

Sure
User avatar
Lambda
Posts: 1021
Joined: Fri Mar 28, 2014 9:39 am
Pronouns: She, her
Contact:

Re: Cooperative Zendo

Post by Lambda »

Valid strings: zero or more alphanumeric characters. [A-Za-z0-9]*

SHA1 hash of rule: 8972b046e01af88b4bfbd977787c3f55f7a65b76
$ echo -n "A valid string is one that conforms to the secret rule." | sha1sum -

Yes: water
No: fire
User avatar
Lambda
Posts: 1021
Joined: Fri Mar 28, 2014 9:39 am
Pronouns: She, her
Contact:

Re: Cooperative Zendo

Post by Lambda »

(For the convenience of archive-readers: The next round starts here.)
Last edited by Lambda on Wed Oct 05, 2016 11:47 am, edited 1 time in total.
User avatar
DanielH
Posts: 3745
Joined: Tue Apr 01, 2014 1:50 pm
Pronouns: he/him/his

Re: Cooperative Zendo

Post by DanielH »

Hey, what a coincidence, that’s how I generated my hash. It’s compatible with http://www.sha1-online.com/ (as you would expect, but some tools auto-add newlines), at least if the entire rule is one ASCII line (I haven’t tested anything else).

earth
air

fir
fi
f

λ (meaning empty string, not the current master)

fier
fiter
witer
water
User avatar
Lambda
Posts: 1021
Joined: Fri Mar 28, 2014 9:39 am
Pronouns: She, her
Contact:

Re: Cooperative Zendo

Post by Lambda »

earth: yes
air: yes
fir: yes
fi: no
f: no
(empty string): no
fier: no
fiter: yes
witer: yes
water: yes (already given)
Koans
Yes:
air
earth
fir
fiter
water
witer


No:
(empty string)
f
fi
fier
fire
User avatar
Timepoof
Posts: 488
Joined: Sun Nov 29, 2015 6:16 pm
Pronouns: she/her/hers
Location: On a sparkly throne with soft fluffy cushions
Contact:

Re: Cooperative Zendo

Post by Timepoof »

rererer
iter
abcdefghijklmnopqrstuvwxyz
The WAFFLES will submit to this indignity.
User avatar
DanielH
Posts: 3745
Joined: Tue Apr 01, 2014 1:50 pm
Pronouns: he/him/his

Re: Cooperative Zendo

Post by DanielH »

EaRtH
AiR
FiRe
WaTeR

0123456789

ari
iar
ira
rai
ria
Post Reply