Page 13 of 49

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 8:20 pm
by Lambda
(Characters other than LRlr have no effect.)

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 8:49 pm
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]

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 9:17 pm
by Lambda
Yay!

Does this mean I get to be the next setter?

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 9:45 pm
by DanielH
Sure

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 10:02 pm
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

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 10:02 pm
by Lambda
(For the convenience of archive-readers: The next round starts here.)

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 10:08 pm
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

Re: Cooperative Zendo

Posted: Tue Sep 13, 2016 10:33 pm
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

Re: Cooperative Zendo

Posted: Wed Sep 14, 2016 5:35 am
by Timepoof
rererer
iter
abcdefghijklmnopqrstuvwxyz

Re: Cooperative Zendo

Posted: Wed Sep 14, 2016 5:38 am
by DanielH
EaRtH
AiR
FiRe
WaTeR

0123456789

ari
iar
ira
rai
ria