見出し画像

[開発部]ボートレース統計学ロボットの、開発リーダーを募集します

舟式会社ボートレース統計学、社長の舟猫です。

当社では現在、ボートレースを統計学で的中しそうな買い目を探るロボット、通称ボートレース統計学ロボットの開発リーダーを募集しております。

業務内容

ウルトラエグゼクティブスーパー開発部長 1名

社長は記事を書くことにほぼ専念しているので、お手伝いという形でメンバーシップに参加していただき開発部を取りまとめていただきます。

給与

0円

希望する人材

ある程度Pythonがわかる方

当社のロボット開発はプログラミング言語Pythonを使用します。ほかの言語は今のところ考えておりません。

スキルはまったく問いませんが、pandasを勉強中の方、もしくは扱える方なら助かります。

なお、統計学が何のことやら分からない方でも問題ありません。

知ったかぶりをしない方

知らないことがあるのは当然ですし、そこまでエキスパートの方は逆に求めません。知識があったとしても変に玄人ぶらない方を希望します。

一番の初心者のペースに合わせれる方

メンバーシップには統計学やプログラミングに関心を持ち始めたばかりの方の参加も想定していますので、その中でもっとも初心者の方の歩幅で開発を進めていただける方を希望します。

話し合いのできる方

ロボット開発に関しては全面的におまかせしますが、その様子をはたから見ていて私から一丁前に口出しすることも考えられます。

そのときはもちろんご意見は尊重しますが、私の考えも含めてきっちりと掲示板でお話できる方を希望します。

給与

0円

入社試験

この記事の一番下に正解かどうかまったくわからない、苦し紛れに書いたPythonのコードがあります。

ボートレースの買い目をフォーメーションの形式にしたいがために作ったものなのですが、これに的確なダメ出しをしていただきます。

いや、どうか助けてください。正解をおしえてください──

コメント欄でも結構ですし、noteで記事として書いていただき公開しないにしても下書きで共有するようにしていたければダメ出しが伝わりやすいかもしれません。

給与

0円

以上、たくさんのご応募お待ちしております。

入社試験用コード

import itertools

class CompressedCombs:
	def get(
		self,
		combinations: list
	):
		if len(combinations) == 0:
			return ()
		if len(combinations[0]) == 5:
			_first_cnt = 3
		else:
			_first_cnt = 2
		if '-' in combinations[0]:
			_tf = '-'
		else:
			_tf = '='
			combinations = [
				sorted(str(i).replace('=', '')) for i in combinations
			]
			combinations = [
				'='.join(i) for i in combinations
			]
		combinations = sorted(list(set(combinations)))
		expanded_combination_cnt = len(combinations)
		if len(combinations) == 1:
			return tuple(combinations)
		while True:
			combination_cnt = len(combinations)
			none_cnt = None
			for index in range(combination_cnt - 1):
				for shift in range(
					index + 1,
					combination_cnt
				):
					if (
						[
							combinations[index],
							combinations[shift]
						].count(None) == 0
					):
						combinations = self.combine(
							combinations,
							_first_cnt,
							_tf,
							index,
							shift,
						)
					if (
						none_cnt is not None
						and combinations.count(None) != none_cnt
					):
						break
					else:
						none_cnt = combinations.count(None)
			combinations = [
				i for i in combinations if i is not None
			]
			if len(combinations) == combination_cnt:
				break
		compressed_combination_cnt = 0
		for index, combination in enumerate(
			combinations
		):
			compressed_combination_cnt += len(
				expanded_comb(
					combination
				)
			)
			if _tf == '=':
				temp_combinations = combination.split('=')
				temp_combinations = (
					sorted(temp_combinations)
				)
				combinations[index] = (
					'='.join(temp_combinations)
				)
		return tuple(combinations)

	def combine(
		self,
		combinations,
		_first_cnt,
		_tf,
		index,
		shift,
	):
		criteria = (
			expanded_comb(
				combinations[index]
			)
		)
		criteria += (
			expanded_comb(
				combinations[shift]
			)
		)
		criteria = (
			sorted(list(set(criteria)))
		)
		splits = combinations[index].split(_tf)
		if _tf == '-':
			splits = [tuple(splits)]
		else:
			splits = list(
				itertools.permutations(
					combinations[index].split(_tf),
					_first_cnt
				)
			)
		additions = combinations[shift].split(_tf)
		should_break = False
		for _splits in splits:
			_splits = list(_splits)
			for first in range(_first_cnt):
				_splits[first] += additions[first]
				_splits[first] = (
					sorted(list(set(_splits[first])))
				)
				_splits[first] = (
					''.join(_splits[first])
				)
				if (
					sorted(
						expanded_comb(
							_tf.join(_splits)
						)
					) == criteria
				):
					combinations[index] = (
						_tf.join(_splits)
					)
					combinations[shift] = None
					should_break = True
					break
			if should_break:
				break
		return combinations

def expanded_comb(
	combination: str
):
	if combination is None:
		return []
	if combination.replace('=', '-').count('-') == 2:
		_first_cnt = 3
	else:
		_first_cnt = 2
	if '-' in combination:
		_tf = '-'
	else:
		_tf = '='
	if _first_cnt == 2:
		combination += f'{_tf}7'
	nums = combination.split(_tf)
	for num in nums:
		if len(num) == 0:
			return []
	_expanded_combinations = []
	for left in nums[0]:
		for center in nums[1]:
			for right in nums[2]:
				if (
					left != center
					and center != right
					and right != left
				):
					_expanded_combination = (
						f'{left}{center}{right}'
					)
					if _tf == '=':
						_expanded_combination = (
							''.join(
								sorted(
									_expanded_combination
								)
							)
						)
					_expanded_combinations.append(
						_expanded_combination[: _first_cnt]
					)
	_expanded_combinations = (
		sorted(
			set(_expanded_combinations)
		)
	)
	_expanded_combinations = [
		str(_tf).join(i) for i in _expanded_combinations
	]
	return _expanded_combinations


if __name__ == "__main__":
	pass

ここから先は

0字

ボートレースを統計学する架空の企業🏢。記事を書き貯めておく倉庫事業を中心に展開🖥️。 社長は執…

正社員

¥1,500 / 月

秘書

¥2,000 / 月

この記事が気に入ったらサポートをしてみませんか?