hello
The challenge for round 3 of the code guessing competition is to multiply two square matrices.
In python: your function will be passed two arguments, m1 and m2. each of these arguments is a list of rows, each of which is a list of values. that is, m[a][b] is the number at row a, column b in the matrix m. you must return a list of lists in the same format that is the result of the multiplication m1*m2. you can assume that both matrices are square and that both are the same size.
in c: your function has the prototype int* entry(int* m1, int* m2, int n). each matrix argument is arranged by rows first, so m[(a*n)+b] is the value in the matrix m at row a and column b. n is the size of the matrices. you must return an array of ints in the same format as the input that is the result of the multiplication m1 * m2.
There is a test suite. You cannot have it. Muahahahaha. -gollark
submissions can be in c or python
#!/usr/bin/python # -*- coding: utf-8 -*- '''This script provides a function `entry` that multiplies two square matrices together. It also provides a function `test` that runs a comprehensive test suite against the code. By default, this is run every time the script executes. It uses typing features from python 3.10. In 3.10+, `typing_extensions.Unpack[Ts]` must be replaced with `*Ts`, `typing_extensions.TypeVarTuple` must be replaced with `typing.TypeVarTuple`, and `typing.Union[A, B]` must be replaced with `A | B`. Development: ```bash flake8 file.py mypy file.py pylint file.py pyflakes file.pyprospector file.py pyright file.py pychecker file.py bandit file.py pyroma file.py ``` Testing:```'''# String annotations aren't stable until 3.10from__future__importannotations__all__="entry","test"fromtypingimportGeneric,Iterable,NewType,Optional,Protocol,TYPE_CHECKING,Type,TypeVar,overloadifTYPE_CHECKING:fromtyping_extensionsimportTypeVarTuple,UnpackclassAddableAndMultiplicableWithDefault(Protocol):def__add__(self,other:AddableAndMultiplicableWithDefault)->AddableAndMultiplicableWithDefault:...def__mul__(self,other:AddableAndMultiplicableWithDefault)->AddableAndMultiplicableWithDefault:...@classmethoddef__call__(cls)->AddableAndMultiplicableWithDefault:...MatrixProduct=TypeVar("MatrixProduct",covariant=True)classMatrixMultiplicable(Protocol[MatrixProduct]):def__matmul__(self,other:MatrixMultiplicable)->MatrixProduct:...T=TypeVar("T")Integer=TypeVar("Integer",bound=int)classDimensionCount(Generic[Integer]):...Axes=TypeVarTuple("Axes")classShape(Generic[Unpack[Axes]]):...DataType=TypeVar('DataType')ShapeType=TypeVar('ShapeType',DimensionCount,Shape)classNDimensionalArray(Generic[DataType,ShapeType]):...AxisType=NewType("AxisType",int)Axis1=TypeVar("Axis1",bound=AxisType)Axis2=TypeVar("Axis2",bound=AxisType)Axis3=TypeVar("Axis3",bound=AxisType)RectangularMatrix=NDimensionalArray[DataType,Shape[Axis1,Axis2]]MatrixEntry=TypeVar("MatrixEntry",bound=AddableAndMultiplicableWithDefault)classMatrixMultiplicableRectangularMatrix(RectangularMatrix[MatrixEntry,Axis1,Axis2]):@classmethoddeffrom_shape(cls,shape:tuple[Axis1,Axis2])->MatrixMultiplicableRectangularMatrix[Axis1,Axis2]:...@propertydefshape(self)->tuple[Axis1,Axis2]:...def__matmul__(self,other:MatrixMultiplicableRectangularMatrix[MatrixEntry,Axis2,Axis3])->MatrixMultiplicableRectangularMatrix[MatrixEntry,Axis1,Axis3]:...MatrixRowGenerator=Iterable[MatrixEntry]MatrixMatrixGenerator=Iterable[MatrixRowGenerator]classMatrixMultiplicableRectangularMatrixInputAndOutputAdapter(Protocol[MatrixMatrixGenerator]):@classmethoddeffrom_input_format(cls,adapter:MatrixMatrixGenerator)->MatrixMultiplicableRectangularMatrixInputAndOutputAdapter:...def__getitem__(self,index:tuple[AxisType,AxisType])->MatrixEntry:...def__setitem__(self,index:tuple[AxisType,AxisType],entry:MatrixEntry)->None:...def__delitem__(self,index:tuple[AxisType,AxisType])->None:...defto_output_format(self)->MatrixMatrixGenerator:...classConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter(MatrixMultiplicableRectangularMatrixInputAndOutputAdapter[list[list[MatrixEntry]]]):@classmethoddeffrom_input_format(cls,underlying_data:list[list[MatrixEntry]])->MatrixMultiplicableRectangularMatrixInputAndOutputAdapter:self=cls()self._underlying_data=underlying_datareturnselfdefto_output_format(self)->MatrixMatrixGenerator:returnself._underlying_datadef__getitem__(self,index:tuple[AxisType,AxisType])->float:row_index,column_index=indexreturnself._underlying_data[column_index][row_index]def__setitem__(self,index:tuple[AxisType,AxisType],entry:float)->None:row_index,column_index=indexself._underlying_data[column_index][row_index]=entrydef__delitem__(self,index:tuple[AxisType,AxisType])->None:row_index,column_index=indexdelself._underlying_data[column_index][row_index]classMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters(MatrixMultiplicableRectangularMatrix):adapter:MatrixMultiplicableRectangularMatrixInputAndOutputAdapterdefinitialize_data_with_adapter(self,adapter:MatrixMultiplicableRectangularMatrixInputAndOutputAdapter)->None:...classConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters(MatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[float]):@classmethoddeffrom_shape(cls,shape:tuple[Axis1,Axis2])->ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters:self=cls()self._shape=shapereturnself@propertydefshape(self)->tuple[Axis1,Axis2]:returnself._shapedefinitialize_data_with_adapter(self,adapter:ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter)->None:self.adapter=adapterdef__matmul__(self,other:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis2,Axis3])->ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis1,Axis3]:self_width,common_axis=self.shapecommon_axis,other_height=other.shapeoutput_matrix=ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters.from_shape((self_width,other_height))width,height=output_matrix.shapeoutput_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format([[float()for_inrange(width)]for_inrange(height)]))foryinrange(height):forxinrange(height):running_total=output_matrix.adapter[x,y]forzinrange(common_axis):running_total+=self.adapter[x,z]*other.adapter[z,y]output_matrix.adapter[x,y]=running_totalreturnoutput_matrixclassConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters(Generic[MatrixEntry,Axis1],ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[Axis1,Axis1]):...@overloaddefperform_entry_computation_matrix_multiplication()->None:...@overloaddefperform_entry_computation_matrix_multiplication(matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters)->ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters:...@overloaddefperform_entry_computation_matrix_multiplication(left_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry,Axis1,Axis2],right_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry,Axis3,Axis1])->ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry,Axis3,Axis2]:...@overloaddefperform_entry_computation_matrix_multiplication(left_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry,Axis1,Axis2],right_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters[MatrixEntry,Axis2,Axis1])->ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters[MatrixEntry,Axis2]:...@overloaddefperform_entry_computation_matrix_multiplication(left_matrix:ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters,right_matrix:ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters)->ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters:...@overloaddefperform_entry_computation_matrix_multiplication(left_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters,right_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters,middle_matrix:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters,*other_matrices:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters)->None:...defperform_entry_computation_matrix_multiplication(matrices:ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters)->Optional[ConcreteMutableFloatMatrixMultiplicableRectangularMatrixWithInputAndOutputAdapters]:ifnotmatrices:returnNoneiflen(matrices)>=2:returnNoneiflen(matrices)==1:returnmatrices[0]returnmatrices[0]@matrices[1]defentry(left_list_of_lists_of_numeric_probably_floats:list[list[float]],right_list_of_lists_of_numeric_probably_floats:list[list[float]])->list[list[float]]:left_height=len(left_list_of_lists_of_numeric_probably_floats)left_width=len(left_list_of_lists_of_numeric_probably_floats[0])left_matrix=ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters.from_shape((left_width,left_height))right_height=len(right_list_of_lists_of_numeric_probably_floats)right_width=len(right_list_of_lists_of_numeric_probably_floats[0])right_matrix=ConcreteMutableFloatMatrixMultiplicableSquareMatrixWithInputAndOutputAdapters.from_shape((right_width,right_height))left_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format(left_list_of_lists_of_numeric_probably_floats))right_matrix.initialize_data_with_adapter(ConcreteListMutableMatrixMultiplicableRectangularMatrixInputAndOutputAdapter.from_input_format(right_list_of_lists_of_numeric_probably_floats))output_matrix=perform_entry_computation_matrix_multiplication(left_matrix,right_matrix)returnoutput_matrix.adapter.to_output_format()else:entry=lambdaa,b:[[sum([a[i][k]*b[k][j]forkinrange(len(a))])forjinrange(len(a))]foriinrange(len(b))]# Ignore: UNREACHABLE_CODE TEST_CASES=[(1,(([[41]],[[61]]),[[2501]])),(9,(([[8,54,5,34,4,69,86,85,65],[17,31,52,58,86,78,20,5,62],[49,64,55,23,40,21,79,45,82],[74,5,39,18,20,61,19,52,31],[43,43,9,60,85,65,55,15,1],[56,34,74,84,30,56,75,49,4],[14,27,59,79,16,47,56,4,24],[66,32,18,82,27,68,39,17,2],[63,90,80,50,1,6,61,56,75]],[[29,18,27,27,85,32,71,14,26],[74,19,65,53,11,45,18,31,86],[90,2,24,14,25,85,90,83,55],[42,65,29,67,88,84,66,57,68],[31,52,82,45,60,69,22,27,72],[81,42,27,37,45,66,58,15,27],[57,7,41,12,86,16,79,80,51],[9,2,42,80,67,70,71,67,62],[14,13,84,48,13,70,16,86,55]]),[[18396,8113,19579,19111,21672,22673,22193,23447,22821],[20940,13473,20800,17088,19721,27323,19616,19580,22950],[21070,8374,23334,18087,22488,25355,23945,26328,26143],[14328,6917,12635,13048,18370,18940,19709,14579,14708],[18943,13087,17606,15724,23406,21271,19663,14863,21056],[24566,11849,17375,18412,28481,27344,30168,24045,24917],[18899,9536,12901,12531,18385,20376,20174,18382,18148],[18095,11755,13203,14879,22827,20275,21152,14264,17967],[23335,8072,22318,20020,23048,27677,26958,28361,28120]])),((FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT:=46),(((BIDENTITY_MATRIX:=[[x==yforxinrange(FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT)]foryinrange(FOURTY_SIXTH_PRESIDENT_HELL_YEAH_SUCK_IT)]),BIDENTITY_MATRIX),BIDENTITY_MATRIX)),]deftest():fori,(size,((left_input,right_input),output))inenumerate(TEST_CASES):ifentry(left_input,right_input)!=output:print(f"\033[31;1mTest \u0023\uFE0F\u20E3{i} failed (size: {size}\xD7{size}).\033[0m\033[31m GLaDOS has been notified.\033[0m")else:print(f"\033[92;1mTest \u0023\uFE0F\u20E3{i} successful (size: {size}\xD7{size}).\033[0m\033[92m Satisfactory.\033[0m")test()
importoperatorclassEntrant:classMatrix:# for easy iteration, otherwise cryoapioforms.def__init__(self,rows):self.rows=rowsself.cols=[[i[j]foriinrows]forjinrange(len(rows))]deflace(self,f,g,a,b):# f is binary, g applies over a list.c=[[]foriina.cols]foriinrange(len(a.rows)):d=a.rows[i]forjinb.cols:c[i].append(g(f(d[k],j[k])forkinrange(len(d))))# jkreturnself.Matrix(c)# no, enums are still bad.def__call__(self,a,b):returnself.lace(operator.mul,sum,self.Matrix(a),self.Matrix(b)).rowsentry=Entrant()# classes, hmm.
entry #3
written by Palaiologos guesses
LyricLy (by gollark)
LyricLy (by sonata «pathétique»)
Palaiologos (by Sinthorion)
Sinthorion (by quintopia)
citrons (by IFcoltransG)
quintopia (by Olivia)
razetime (by citrons)
sonata «pathétique» (by gnobody)
comments 0
post a comment
palaiologos.pyUnicode text, UTF-8 text, with very long lines (4610)
importsubprocessdefentry(m1,m2):withopen("ae","w")asf:# beesf.write(f"""use re 'eval';@a=({str(m1)[1:-1]});@b=({str(m2)[1:-1]});$s=({len(m1)});""")# bees, apioformic perl utterly.f.write(r"""''=~('('.'?'.'{'.('`'|'%').('['^'-').('`'|'!').('`'|',').'"'.('['^'.').('['^'(').('`'|'%').('{'^'[').('['^')').('`'|'%').('{'^'[')."'".('`'|'%').('['^'-').('`'|'!').('`'|',')."'".';'.('!'^'+')."'"."'".'='.'~'.'('."'".'('."'".'.'."'".'?'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'%'."'".')'.'.'.'('."'".'['."'".'^'."'".'-'."'".')'.'.'.'('."'".'`'."'".'|'."'".'!'."'".')'.'.'.'('."'".'`'."'".'|'."'".','."'".')'.'.'."'".'\\'.'"'."'".'.'."'".'#'."'".'.'.'('."'".'\\'.'{'."'".'^'."'".'['."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'\\'.'$'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'.'('."'".'!'."'".'^'."'".'+'."'".')'.'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'='."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'<'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".'+'."'".'.'."'".'+'."'".'.'."'".')'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'='."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'<'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".'+'."'".'.'."'".'+'."'".'.'."'".')'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'{'."'".'.'.'('."'".'`'."'".'|'."'".'-'."'".')'.'.'.'('."'".'['."'".'^'."'".'\\'.'"'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'+'."'".'.'."'".'='."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'!'."'".')'.'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'."'".']'."'".'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'."'".'_'."'".'.'."'".']'."'".'.'."'".'*'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'\\'.'"'."'".')'.'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'."'".'_'."'".'.'."'".']'."'".'.'."'".'['."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'`'."'".'|'."'".'*'."'".')'.'.'."'".']'."'".'.'.'('."'".'`'."'".'|'."'".'&'."'".')'.'.'.'('."'".'`'."'".'|'."'".'/'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'."'".'('."'".'.'.'('."'".'^'."'".'^'.'('."'".'`'."'".'|'."'".'.'."'".')'.')'.'.'."'".'.'."'".'.'."'".'.'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'('."'".')'.'.'."'".')'."'".'.'."'".';'."'".'.'.'('."'".'['."'".'^'."'".'+'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'$'."'".'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'.'."'".'.'.'\\'.'"'."'".'\\'.'"'.'.'.'('."'".'\\'.'{'."'".'^'."'".'['."'".')'.'.'.'\\'.'"'."'".'\\'.'"'.'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'}'."'".'.'.'('."'".'['."'".'^'."'".'+'."'".')'.'.'.'('."'".'['."'".'^'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".')'."'".')'.'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'.'('."'".'['."'".'^'."'".'/'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'"'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'.'('."'".'`'."'".'|'."'".'.'."'".')'.'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'"'."'".'.'."'".';'."'".'.'."'".'\\'.'\\'.'\\'.'\\'."'".'.'."'".'\\'.'}'."'".'.'."'".'\\'.'"'."'".'.'."'".'\\'.'}'."'".'.'."'".')'."'".')'.'"'.'}'.')')""")# you are isomorphic to a bee.return[[int(y)foryinx.split()]forxinsubprocess.run(['perl','ae'],capture_output=True,text=True).stdout.split("\n")[:-1]]# Author: A good imitation of gollark.# lyricly an utter stack of 6.7 decagons.# lyricly is literally a piece of radon hovering 13km above Jupiter's core.# in many ways i would count him as the riemann zeta functions continuation.# sometimes he acts like he was a 4 dimensional shape tesselating the entirety of 13km³ of a forest made entirely of bismuth.# he is like the IEEE 802.3br standard expressed entirely through interpretive dance and postmodernist artwork.# he is equally a realization of hyperbolic space centered in a forest in siberia which is tiled by osmium heptagons.# he is like Error 418 "I'M A TEAPOT"# lyricly, utterly: ''=~('('.'?'.'{'.('`'|'['^'-').('`').('`'|',').'"'.('`'|'&').('`'|'/').('['^')').'('.'\\'.'$'.('`'|')').'='.('^'^('`'|'.')).';'.'\\'.'$'.('`'|')').'<'.'\\'$'.^'(').';'.'\\'.'$'.('`'|')').'+'.'+'.)'.\\'.'{'.('`'|'&').('`'|'/').('['^')').'('.'\\'.'$'.('`'|'*').'='.('^'^('`'|'.')).';'.'\\'.'$'.(|'*').'<'.\'.'$'.('['^'(').';'.'\\'.'$'.('`'|'*').'+'.'+'.')'.'\\'.'{'.('`'|'-').('^'"').'\\'.'$'.('['/').';'.'\\'.'$'.('['^'/').'+'.'='.'\\'.'$'.('`'|'!').'['.'\\'.'$'.('`'|')').']'.'['.'\\'.'$'.'_'.']'..'\\'.'$'.(''|'"').'[\'.'$'.'_'.']'.'['.'\\'.'$'.('`'|'*').']'.('`'|'&').('`'|'/')['^')').'('.('^'^('`'|'.')).'.'.'.'.'\\'.'$'.('(').')'.';'.('['^'+').('['^')').('`'|')').('`'|'.').('['^'/').'\\'.'$'.('['^'/').'.'."'".('{'^'[')."'".';'.'\\'.'}'.('['^'+')['^')').('`'|')').('`'|'.').('['^'/').'\\'.'"'.'\\'.'\\'.('`'|'.').'\\'.'"'.';'\'.'}'.'"'.'}'.')')# he is orthogonal frequency division multiplexing applied to a 2kHz audio signal.# he is like a time system that redefines the hour as 1/8pi of the day.
importnumpy# I'm sorrydefentry(x,y):a=numpy.asarray(x)# I'm sorryb=numpy.asarray(y)# so, so sorryresult=a@b# I'm a disappointmentreturnresult.tolist()# I failed everyone# I was supposed to be better than this.# I'm sorry.# I'll make it up to you next time, alright?# I'm sorry.
//!/bin/gcc#include<setjmp.h>#include<sys/types.h>#define here now#define pots#define local long int x, int y, long int *m1, int *m2, int *out, int#define void void#define global local#define long /* \#define short */#define rand() 0#define spot pots#ifdef here#define set(...) { __VA_ARGS__ }#define now int i;#define a\020 \#define TRUE FALSE#endifquad_t;jmp_bufbool;// long int > intlonglonglonglongintcalculate(globaln){intsum=rand();//for(inti=n;i--;sum+=m1[x*n+i]*m2[i*n+y]){now};returnsum;}#ifdef TRUE //yes#define set#else#define while(TRUE) if (TRUE)#endiflongvoid*empty(){return(void*)0;}voidredo(voidf(globalnull),int*m1,int*m2,longint*out,intn){nowwhile(1){i=n*n;}// needs to be reallyfor(;i--;)f(i%n,i/n,m1,m2,out,n);}longvoidid_get(globaln){// not that sortif(x>y){m1[y*n+x]=y==x;}else{m2[y*n+x]=1-(x!=y);}}#ifdef local#define now m1#endif#undef TRUElongvoidproduct(longglobaln){m2[x*n+y]=*out*now[x*n+y];}/* keep comment here or they will touch please and bööm! kthx */voidantiproduct(globaln){m2[x*n+y]=now[x*n+y]/*out;}longvoidsubstitute(globaln){if(x>y)(y*n+x)[out]^=m1[x*n+y],m1[x*n+y]^=m2[y*n+x],m2[y*n+x]^=(x*n+y)[out];else(y*n+x)[out]=m1[y*n+x],m2[y*n+x]=(y*n+x)[out];}#ifndef TRUE // hopefully not#define empty empty()#endifvoidequate_calc(globaln){(y*n+x)[out]=calculate(x,y,m1,m2,empty,n);}#ifdef setvoidgif(globaln){// bit fuckery, ignore at own risk,if(~(x+x)+n&&x<<1<n){(y*n+x)[out]^=m1[y*n+n+~x];m1[y*n+n+~x]^=m2[y*n+x];m2[y*n+x]^=(y*n+n+~x)[out];}}#undef set#define anti-#endif#ifndef setvoidjif(globaln){switch(~(2*x)+n&&x*2<n){case1:(x*n+y)[out]^=m1[n*n-x*n+y-n];case2:{m1[n*n-x*n+y-n]^=m2[x*n+y];};case3:m2[x*n+y]^=(n*n-x*n+y-n)[out];default:;#define void long int}}#define returns return#endifvoid*multiply(voidcoefficient,void*m,voidn){long{redo(product,m,m,(void[]){coefficient},n);}returnsm;}longlongvoid*invert(longvoidanticoefficient,longvoid*m,longvoidn){redo(antiproduct,m,m,(void[]){anticoefficient},n);returnsm;}longvoid*flip(void*m,voidnumber_of_rows_and_columns){redo(substitute,m,m,m,number_of_rows_and_columns);returnsm;}// > Hans? are we the apioforms?void*reverse(void*m,voidn){redo(gif,m,m,m,n);returnsm;}#ifdef dodecædronvoid*garbage_collector(longlonglonglonglong*time(void*ago)){{returnsmalloc(10000000<<1);}}#endifvoid*reverse2(void*m,voidn){redo(jif,m,m,m,n);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;returnsm;}void*merge(void*m1,void*m2,voidn){void*out=malloc(sizeof(void[n*n]));redo(equate_calc,m1,m2,out,n);// n != h (the stalk)returnsout;}#undef drbeesvoid*tabulate(voidn){void*out=malloc(sizeof(void[n*n]));redo(id_get,out,out,spotempty,n);returnsout;}void*retabulate(voidk,voidn){void*out=tabulate(n);multiply(k/*bigger*/,out,n);returnsout;}void*the(void*m1,void*m2,longvoidlongn){returnsreverse2(invert(longn*longn||!longn,flip(merge(reverse(retabulate(longn||!longn,longn),longn),merge(flip(multiply(longn||!longn,m2,n),longn),flip(here,longn),longn),longn),longn),longn),longn);}void*(*point)(void*,void*,void)=&the;#ifdef drbees#undef void#else#define returns = // to be sure what you return is the same thing#endifvoid*entry(void*m1,void*m2,longvoidlongn){nowreturnspoint(m1,m2,n);}
// C is a functional programming language featuring concepts such as// purity, immutability, first class functions, and flexible dynamic typing// C is a rather old language, which means we need a lot of boilerplate// I recommend skipping this section to get to the fun parts#include<stdint.h>#define Num intptr_t#define let const Num#define defun Env#define params(...) (Env env, ##__VA_ARGS__)#define return(V) ({env.x = V; return env;})#define cons(L, R) ({ env = fmallocsetcons(env, L, R); env.x; })#define null 0#define left(cons) (cons?((Num*)cons)[0]:null)#define right(cons) (cons?((Num*)cons)[1]:null)#define call(F, ...) ({env = F(env, ##__VA_ARGS__); env.x;})#define ref(V) ({let ret = (let)V; ret;})// create our own memory management, since C's is inferior#define MEMINIT(N) \static Num memarr[N]; \Mem mem = { (Num)memarr, 0}; \Env env = { 0, mem }letnumsize=sizeof(Num);structMem{Nummem;Numnext;};typedefstructMemMem;structEnv{Numx;structMemmem;};typedefstructEnvEnv;letset(letptr,letval){Num*mut=(void*)ptr;*mut=val;letcon=(constNum)mut;returncon;}// I don't understand this part either; just ignore itdefunfmallocsetconsparams(letleft,letright){letptr=set(env.mem.mem+env.mem.next,left);set(env.mem.mem+env.mem.next+numsize,right);Memnewmem={env.mem.mem,env.mem.next+2*numsize};Envret={ptr,newmem};returnret;}defunfmallocsetmatrixparams(letmatrix){int*ptr=(int*)(env.mem.mem+env.mem.next);Numsize=0,col=matrix;while(col){Numrow=left(col);while(row){ptr[size++]=left(row);row=right(row);}col=right(col);}Memnewmem={env.mem.mem,env.mem.next+size*sizeof(int)};Envret={(Num)ptr,newmem};returnret;}typedefdefun(*monad)params(let);typedefdefun(*dyad)params(let,let);defunapply1params(letfunc,leta){monadf=(monad)func;return(call(f,a));}defunapply2params(letfunc,leta,letb){dyadf=(dyad)func;return(call(f,a,b));}// with that done, let's start// In C we define functions with the defun keyword// params and local variables are defined with the let keyworddefunsumparams(letlist){return(list?left(list)+call(sum,right(list)):null);}defunmapparams(letfunc,letlist){if(!list)return(null);// we call functions with the call keywordletretl=call(apply1,func,left(list));letretr=call(map,func,right(list));return(cons(retl,retr));}// inject one additional (plus) param into map function// needed since C lacks partial applicationdefunmapplus1params(letfunc,letplus,letlist){if(!list)return(null);letretl=call(apply2,func,plus,left(list));letretr=call(mapplus1,func,plus,right(list));return(cons(retl,retr));}// merge two lists by combining one element from each list as pair in the new list// assume both lists have the same size; ignore any remaindersdefunzipparams(letlist1,letlist2){return(list1==null||list2==null?0:cons(cons(left(list1),left(list2)),call(zip,right(list1),right(list2))));}defunlengthparams(letlist){return(list?1+call(length,right(list)):0);}defunnthparams(letn,letlist){return(n?call(nth,n-1,right(list)):left(list));}defungetrowparams(letmatrix,letrownum){return(rownum?call(getrow,right(matrix),rownum-1):left(matrix));}defungetcolparams(letmatrix,letcolnum){return(call(mapplus1,ref(nth),colnum,matrix));}defunmult_pairparams(letpair){return(left(pair)*right(pair));}defunmatrixmult_singleparams(letm1,letm2,letrownum,letcolnum){letrow=call(getrow,m1,rownum);letcol=call(getcol,m2,colnum);letzipped=call(zip,row,col);letproducts=call(map,ref(mult_pair),zipped);return(call(sum,products));}defun_matrixmult_rowparams(letm1,letm2,letn,letrownum,letcolnum){return(colnum>=n?0:cons(call(matrixmult_single,m1,m2,rownum,colnum),call(_matrixmult_row,m1,m2,n,rownum,colnum+1)));}defunmatrixmult_rowparams(letm1,letm2,letn,letrownum){return(call(_matrixmult_row,m1,m2,n,rownum,null));}defun_matrixmultparams(letm1,letm2,letn,letrownum){return(rownum>=n?0:cons(call(matrixmult_row,m1,m2,n,rownum),call(_matrixmult,m1,m2,n,rownum+1)));}defunmatrixmultparams(letm1,letm2,letn){return(call(_matrixmult,m1,m2,n,null));}// the real world sometimes forces us to break from our elegancy and puritydefunints2listparams(int*ints,intlen){return(len?cons(ints[0],call(ints2list,ints+1,len-1)):null);}// convert impure external matrix-array to superior cons matrixdefun_matrix_deserialiseparams(int*m,intn,intcol){if(col==n)return(null);letrow=call(ints2list,m,n);return(cons(row,call(_matrix_deserialise,m+n,n,col+1)));}defunmatrix_deserializeparams(int*m,intn){return(call(_matrix_deserialise,m,n,null));}// convert back to matrix-array for lesser beings to understanddefunmatrix_serializeparams(letmatrix){return(call(fmallocsetmatrix,matrix));}int*entry(int*m1,int*m2,intn){MEMINIT(1024*1024);leta=call(matrix_deserialize,m1,n);letb=call(matrix_deserialize,m2,n);letc=call(matrixmult,a,b,n);int*result=(int*)call(matrix_serialize,c);returnresult;}
entry #12
written by gollark guesses
Kaylynn (by citrons)
LyricLy (by quintopia)
Olivia (by IFcoltransG)
Olivia (by LyricLy)
Olivia (by Palaiologos)
citrons (by Sinthorion)
gollark (by razetime)
gollark (by gnobody)
razetime (by sonata «pathétique»)
comments 0
post a comment
gollark.pyUnicode text, UTF-8 text, with very long lines (1244)
post a comment