,[------------------------------------------------[->>>>>>+<<<<<<]>,------------
---------------------------------[--->>>>>[-<<<<++++++++++>>>>]<<<<<[->+<],[-]]>
>>>>[-<<<<+>>>>]<<<<<<,------------------------------------------------[->>>>>>+
<<<<<<]>,--------------------------------------------[---->>>>>[-<<<++++++++++>>
>]<<<<<[->>+<<],[-]]>>>>>[-<<<+>>>]<<<<<<,--------------------------------------
----------[->>>>>>+<<<<<<]>,---------------------------------------------[--->>>
>>[-<<++++++++++>>]<<<<<[->>>+<<<],[-]]>>>>>[-<<+>>]<<<<<<,---------------------
---------------------------[->>>>>>+<<<<<<]>,----------[------------------------
-------------->>>>>[-<++++++++++>]<<<<<[->>>>+<<<<],[-]]>>>>>[-<+>]>+<<<<<[->>>>
>>>+<<<<<<<]>>[->>>>>>+<<<<<<]>>>>>[->-[>]<<]<[->>>>>>+<<<<[[-]>>>>[-]<<<<<<<<<<
[->+<]>>[-<<+>>]<<<<+>>[->-[>]<<]<[->>>>>>>>>>>+<<<<<<<<<<<]<[-<]>>>>>>]>>>>[-<+
<<]<<<]<[-<<[-<+>]<<<<+>>[->-[>]<<]<[->>>>>>>>>>>+<<<<<<<<<<<]<[-<]>>>>>>]>>>>>[
-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-],]>>>>>>>>>>>>>>++++++++++<<[[->+>
-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>>>>>>[>]++++++++++++++++++++++++++++++++++++++++++
++++++[<]<<<[-<+>>>>>[>]<+[<]<<<]>[-<<<<+>>>>]<<<[-]<]>>>>>>>[>]<[.<]++++++++++.
otherwise
yet, thats neat from collections import namedtuple
import re
import sys
MOVE_RE=re.compile("^move (?P<count>[0-9]+) from (?P<from_>[0-9]+) to (?P<to>[0-9]+)")
Move = namedtuple("Move", "count from_ to")
def parse_stacks(input):
input = input.splitlines()
return [[c for c in (input[-y - 2][x * 4 + 1] for y in range(len(input) - 1)) if c != " "] for x in range(9)]
def parse_moves(input):
return [Move(**{k: int(v) for k, v in MOVE_RE.match(line).groupdict().items()}) for line in input.splitlines()]
input_stacks, input_moves = open(sys.argv[1] if len(sys.argv) > 1 else "input").read().split("\n\n")
input_stacks, input_moves = parse_stacks(input_stacks), parse_moves(input_moves)
def move1(stacks, move):
stacks[move.to - 1].append(stacks[move.from_ - 1].pop())
def move(stacks, move):
stacks[move.to - 1] += stacks[move.from_ - 1][-move.count:]
stacks[move.from_ - 1] = stacks[move.from_ -1][:-move.count]
stacks = [stack[:] for stack in input_stacks]
for m in input_moves:
for _ in range(m.count):
move1(stacks, m)
print("".join(stack[-1] for stack in stacks))
# G:FWSHSPJWM L:FWSHSPJWM
stacks = [stack[:] for stack in input_stacks]
for m in input_moves:
move(stacks, m)
print("".join(stack[-1] for stack in stacks))
# G:PWPWHGFZS L:PWPWHGFZS
reverse
, so I sneakily gave it another parameterfs::read_to_string("input.txt")?
lines = open('i.input', 'r').readlines()
boxes = [[], [], [], [], [], [], [], [], []]
for i in range(8):
for j in range(1, 33, 4):
column = int((j-1)/4)
boxes[column].insert(0, lines[i][j])
print(boxes)
3693947
Add logs for moderators - Vy0x2
3ba51c4
Extract SSelectionPopupContext::Reset
to reduce duplicate code - Robyt3
f000fce
Add generic confirmation popup to editor - Robyt3
077b0ee
Add "Tools > Remove unused envelopes" to editor - Robyt3
552d60e
Fix cmake args in workspace - Jupeyy
2fe7912
fix some valgrind conditional jump relies on uninit warnings - Jupeyy
59db9ce
FIX: parse & colorify gametype Gores correctly - Avolicious
be7242e
Merge #6071 #6077 #6085 #6088 #6090 - bors[bot][Server] Report extra player info to master http [Ryozuki]
enables to improve the website and other cool stuff in the clientLocalize
to Localizable
in #5853?94678ef
Remove unused struct CDatafileData
- Robyt3
554fc19
Remove unused member SFontSizeChar::m_TouchTime
- Robyt3
78876ab
Remove unused members CColumn::m_Flags
- Robyt3
0a0ddf2
Pass parameters by const reference instead of value when possible - Robyt3
fd208ea
Remove redundant variable assignments - Robyt3
be74dc9
Return actual bool from bool function - Robyt3
39749a3
Fix optional arguments of map_create_pixelart
tool - Robyt3
e134e4e
Remove redundant conditions (always either true or false) - Robyt3
8e67587
Remove redundant null-checks - Robyt3
54a13b1
Remove check for negative unsigned expression - Robyt3
45b645f
Remove assignment of variable to self - Robyt3
ca58bba
Remove redundant bitwise operand - Robyt3
65aa584
Remove redundant conditional expressions - Robyt3
4197e8d
Fix bool being assigned to float variable - Robyt3
19bf435
Remove redundant assignments - Robyt3
f46c9f9
Remove redundant conditional expression before assignment - Robyt3
0f25908
Clarify operator precedence - Robyt3
d286832
Fix potential null-pointer dereference in server logger - Robyt3
2115c12
Handle snap ID potentially being out of range - Robyt3
98706d7
Mark parameters as const
when possible - Robyt3
aa321cd
Move index check before usage, use std::size
- Robyt3
faa9f27
Declare variables as const
when possible - Robyt3
9cba213
Consistently use static const
instead of const static
- Robyt3
cf6e89c
Merge #6035 - bors[bot]const
to the first argument, in menus_browser take my changes and add back Localizable
518210d
Move variable declarations closer to usage - Robyt3
c72861f
Rename class SortWrap
to CSortWrap
- Robyt3
1051a93
Use nullptr
, '\0'
and false
instead of 0
- Robyt3
cbf08b0
Change type of Filtered
from int
to bool
- Robyt3
0c8aac6
Remove unnecessary MatchFound
variable - Robyt3
a6e0e37
Use consistent system name serverbrowser
for log messages - Robyt3
d063524
Remove unused m_NeedRefresh
variable - Robyt3
6d8fad7
Encapsulate m_ResortServerBrowser
inside CServerBrowser
- Robyt3
57d5c5a
Use for-each loop instead of for-loop - Robyt3
4f1ced0
Merge #6095 - bors[bot]