| name | correct guesses | games together | ratio |
|---|---|---|---|
| Olek Sabak | 3 | 4 | 0.750 |
| seshoumara | 6 | 9 | 0.667 |
| ponydork | 4 | 7 | 0.571 |
| Moja | 2 | 4 | 0.500 |
| yeti | 4 | 8 | 0.500 |
| Dolphy | 7 | 15 | 0.467 |
| essaie | 6 | 15 | 0.400 |
| kimapr | 6 | 17 | 0.353 |
| olive | 2 | 6 | 0.333 |
| Makefile_dot_in | 3 | 14 | 0.214 |
| taswelll | 1 | 5 | 0.200 |
| LyricLy | 1 | 7 | 0.143 |
| rrebbbbeca | 1 | 7 | 0.143 |
| Indigo | 1 | 9 | 0.111 |
| hyacinth | 0 | 6 | 0.000 |
| haru~ | 0 | 5 | 0.000 |
| *Ada | 0 | 6 | 0.000 |
| name | correct guesses | games together | ratio |
|---|---|---|---|
| essaie | 9 | 15 | 0.600 |
| hyacinth | 2 | 6 | 0.333 |
| yeti | 2 | 6 | 0.333 |
| Dolphy | 5 | 15 | 0.333 |
| kimapr | 4 | 16 | 0.250 |
| Olek Sabak | 1 | 4 | 0.250 |
| haru~ | 1 | 5 | 0.200 |
| olive | 1 | 5 | 0.200 |
| taswelll | 1 | 5 | 0.200 |
| *Ada | 1 | 6 | 0.167 |
| ponydork | 1 | 7 | 0.143 |
| LyricLy | 1 | 7 | 0.143 |
| Indigo | 1 | 9 | 0.111 |
| seshoumara | 1 | 9 | 0.111 |
| Makefile_dot_in | 0 | 14 | 0.000 |
| rrebbbbeca | 0 | 7 | 0.000 |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // input specifications const variableNames = ["x", "y"]; const andName = "AND"; const orName = "OR"; const notName = "NOT"; const inputString = "(x OR y) AND NOT (x AND y)"; //execution const logicString = inputString.replaceAll(andName, "&&").replaceAll(orName, "||").replaceAll(notName, "!"); function check(variableNames, assigned){ if (assigned.length == variableNames.length){ let tempString = logicString; for (let i = 0; i < assigned.length; i++) { tempString = tempString.replaceAll(variableNames[i], assigned[i]); } return [eval(tempString)]; } else{ return [...check(variableNames, [...assigned, true]), ...check(variableNames, [...assigned, false])]; } } const solutions = check(variableNames, []); const solutionsNumber = solutions.filter(i=>i==true).length.toString(); console.log(solutionsNumber + " solution" + (solutionsNumber!="1" ? "s" : "")); |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | def encrypt(data): #takes bytes object, returns bytes object c = b = 0 o = b'' for m in range(len(data) * 8): if (data[m // 8] >> (7 - (m % 8))) & 1 != b or c == 255: o += bytes([c]) b = not b c = 0 c += 1 return o + bytes([c]) def decrypt(data): #takes bytes object, returns bytes object b = 0 o = '' for c in data: o += str(int(b)) * c if not c == 255: b = not b return bytes([int(o[m:m + 8], 2) for m in range(0, len(o), 8)]) |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | huevosVerdesConJamon = "Yo soy Juan. Yo soy Juan. Yo soy Juan Ramón. ¡Ese Juan Ramón! ¡Ese Juan Ramón! ¡No me gusta nada de ese Juan Ramón! ¿Te gustan los huevos verdes con jamón? No, no me gustan nada, Juan Ramón. No, no me gustan nada los huevos verdes con jamón. ¿Te gustarían aquí o los quieres allá? No, no me gustarían, no los quiero aquí ni allá. No, no me gustarían aquí, allá o más allá. Pues no me gustan nada los huevos verdes con jamón. No, no me gustan nada, Juan Ramón. ¿Te gustarían en un caserón? ¿Te gustarían con un ratón? No, no me gustarían en un caserón. No, no me gustarían con un ratón. No, no me gustarían aquí, allá o más allá. Pues no me gustan nada los huevos verdes con jamón. No, no me gustan nada, Juan Ramón. ¿Los comerías en un cajón con un zorro en un rincón? No los quiero en un cajón con un zorro en un rincón. Tampoco en un caserón y menos con un ratón. No los como aquí ni allá, aquí, allá o más allá. No como huevos verdes con jamón. Pues, no me gustan nada, Juan Ramón. ¿Podrías? ¿Los querrías en un coche? ¡Cómelos que se enfrían esta noche! No los comería, ni querría, en un coche. Te gustarán más en un árbol, quizás. ¡Te gustarán más, ya verás! ¡Déjame ya! No los quiero en un árbol, ¡basta ya! No los quiero en un coche, ¡no de noche! No los quiero en un cajón con un zorro en un rincón. Tampoco en un caserón y menos con un ratón. No los como aquí ni allá, aquí, allá o más allá. No como huevos verdes con jamón. Pues no me gustan nada, Juan Ramón. ¡Un tren! ¡Un tren! ¡Un tren! ¡Un tren! ¿Puedes, quieres en un tren? ¡Déjame ya! No los quiero en un tren, ¡basta ya! No en el árbol, ni en un coche, ni de noche. No los quiero en un cajón con un zorro en un rincón. No como con un ratón, tampoco en un caserón. No los como aquí ni allá, aquí, allá o más allá. No como huevos verdes con jamón. Pues no me gustan nada, Juan Ramón. Dime...¿Y en el túnel? ¡Aquí en el túnel! ¿Podrías, querrías, en el túnel? No podría, ni querría en el túnel. ¿Podrías, querrías en la tormenta? No los quiero en la tormenta, no me tientan. Ni en el túnel ni en el tren me sientan bien. Ni en un árbol, ni en un coche, no me gustan, ni de noche. Ni en un cajón o un caserón, con un zorro o un ratón. No los como aquí ni allá. ¡No me gustan, Juan Ramón! ¿No te gustan los huevos verdes con jamón? No, no me gustan nada, Juan Ramón. ¿Podrías comerlos con una cabra? No podría, ¡palabra! comerlos con una cabra. ¿Podrías, querrías en un barco? No los como en un barco, ni navegando en un charco. Con la cabra y en el túnel, no los como. En la tormenta o en el tren, ni por asomo. Ni en el árbol, ni en un coche, ni de noche. No los quiero en un cajón con un zorro en un rincón. Tampoco en un caserón y menos con un ratón. ¡Basta ya! No los como aquí ni allá, aquí, allá o más allá. ¡No, no me gustan en ninguna ocasión, los huevos verdes con jamón! ¡No, no me gustan nada, Juan Ramón! No te gustan...¡qué ridiculez! ¡Pruébalos una vez! Y te gustarán, tal vez, -ya me lo dirás después- Si los pruebas una vez. ¡Juan! Si me dejas en paz los probaré, ya verás. (... Y él los prueba ...) ¡Vaya! ¡Me gustan los huevos verdes con jamón! ¡Si, me gustan mucho, Juan Ramón! Y los comería en un barco navegando en un charco, Y los comería con la cabra, te doy mi palabra... Los comeré en la tormenta. También me tientan en el túnel y en el tren. ¡Y en un árbol y en un coche y de noche! ¡Qué ricos son, qué ricos son los huevos verdes con jamón! Los comeré en un cajón con un zorro en un rincón. Los quiero en un caserón y también con un ratón. ¡Comeré aquí y allá, aquí, allá o más allá, huevos verdes con jamón! ¡Me gustan mucho, mucho, mucho, los huevos verdes con jamón! ¡Gracias, gracias, Juan Ramón!" escribir(huevosVerdesConJamon) |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | print( sum( [x+1 if x==9 else x for x in[ int( ('0'+ str( int( 'b04ebda239e84d8d54d91', 16 )))[ ord(x)-96 if 96<ord(x)<123 else ord(x)-64 if 64<ord(x)<91 else 0]) for x in input( '''enter your strIng :3 ''' )]]) %10 ) |
submitted at
1 like
1 | BEGIN {for (i = 1; i <= 200; i++) {print (i % 42 == 0) ? "FizzBuzz" : (i % 6 == 0) ? "Fizz" : (i % 7 == 0) ? "Buzz" : i}} #six seveeen 😂😂😂😂😂😂
|
submitted at
0 likes
1 | f(x)={x=1:1,x=2:3,max(join([2...x-1][f([2...x-1])=x],[0]))=0:f(x-1)+1,f(x-1)+1+mod(f(x-1),2)}
|
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Program recaman
integer :: array(100)
array(1) = 0
do n = 2, 100
if (array(n-1)-n < 1) then
array(n) = array(n-1)+n-1
else
array(n) = array(n-1)-n+1
end if
do i = 1, n-1
if (array(n) == array(i)) then
array(n) = array(n-1)+n-1
exit
end if
end do
end do
print *, array
End Program recaman
|
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | print('utf8') width=int(input()) height=int(input()) def grab(coord): return board[coord[1]*width+coord[0]] def find(value): return (value%width,value//width) def grabbox(coord): x,y=coord return ({i[2]:i[1] for i in [(x>0, (x-1,y), 'l'), (x<width-1, (x+1,y), 'r'), (y>0, (x,y-1), 'u'), (y<height-1, (x,y+1), 'd')] if i[0]}) rev = {'l':'r','r':'l','u':'d','d':'u'} side = {'┃':'rl','━':'ud','.':'rlud'} while 1: board = '' for line in range(0, height): board+=input() head = grabbox(find(board.index('0'))) go='' for check in 'rdlu': if check in head: if grab(head[check]) in side: if check in side[grab(head[check])]: go=check print(go) |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 | Run, "msedge.exe" "https://codeguessing.gay/84/"
Clipboard := ""
Loop {
Send "^a"
Send "^c"
if (InStr(Clipboard, "Verify")) {
break
}
}
Send {Tab}{Tab}{Tab}{Enter}
|
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | using System; namespace minesweeper{ class Program{ static void Main(string[] args){ string input = Console.ReadLine(); string[] data = input.Split(' '); int mines = int.Parse(data[0]); bool flipcheck; string[] solution = new string[data.Length]; for (int i = 0; i< data.Length; i++){ if (solution[i] == null){ solution[i]=" "; } if (i>1){ if (data[i] != "-"){ flipcheck = (data[i]== "2" || i - 1 < 2 || i + 2 > data.Length); if (i - 1 > 1){ if (data[i - 1] == "-"){ solution[i - 1] = flipcheck ? "^" : "x"; } } if (i + 1 < data.Length){ if (data[i + 1] == "-"){ solution[i + 1] = flipcheck ? "^" : "x"; } } } } } if (Array.IndexOf(solution, "^") == -1){ if (Array.IndexOf(solution, "x") == -1){ for (int i = 2; i< data.Length; i++){ if (data[i] == "-"){ solution[i] = "^"; } } } else{ for (int i = 2; i< data.Length; i++){ if (solution[i] == "x"){ solution[i] = "^"; } } } } else{ for (int i = 2; i< data.Length; i++){ if (solution[i] == "x"){ solution[i] = " "; } } } Console.WriteLine(string.Join(" ", solution)); } } } |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | "paste this into https://www.desmos.com/calculator, then change p_o's mode to play indefinitely and speed to 7.5"
"or go to https://www.desmos.com/calculator/m5zi3yomx0"
p_{o}=1
"hit unmute and press play on this one ^"
n_{a}=[62,62,62,62,62,62,62,62,62,62,61,61,62,62,64,64,61,61,61,61,61,61,63,63,63,63,64,64,66,66,69,69,67,67,74,74,73,73,69,69,69,69,66,66,69,69,66,66,64,64,62,62,61,61,59,59,59,59,59,59,59,59,59,59,59,59,50,50,50,50,49,45,45,45,49,49,50,50,52,54,54,54,52,52,50,50,54,52,52,52,47,47,50,50,50,50,52,52,54,54,55,55,54,50,50,50,52,52,54,54,55,54,54,54,52,52,50,50,49,47,47,47,47,47,47,47,47,47,47,47,50,50,50,50,49,45,45,45,49,49,50,50,52,54,54,54,52,52,50,50,54,52,52,52,47,47,50,50,50,50,52,52,54,54,55,55,54,50,50,50,52,52,54,54,55,54,54,54,52,52,50,50,49,47,47,47,47,47,59,57,54,54,54,54,54,47,47,47,47,47,47,47,47,47,59,57,54,54,54,54,55,54,54,52,50,50,51,51,51,47,59,57,54,54,54,54,52,50,50,50,50,47,54,54,52,50,50,50,52,52,54,54,52,49,49,50,47,47,47,47,47,47,59,57,54,54,54,54,54,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,62,62,62,62,61,57,57,57,61,61,62,62,64,66,66,66,64,64,62,62,66,64,64,64,59,59,62,62,62,62,64,64,66,66,67,67,66,62,62,62,64,64,66,66,67,66,66,66,64,64,62,62,61,59,59,59,59,59,59,59,59,59,59,59,62,62,62,62,61,57,57,57,61,61,62,62,64,66,66,66,64,64,62,62,66,64,64,64,59,59,62,62,62,62,64,64,66,66,67,67,66,62,62,62,64,64,66,66,67,66,66,66,64,64,62,62,61,59,59,59,59,59,71,69,66,66,66,66,66,59,59,59,59,59,59,59,59,59,71,69,66,66,66,66,67,66,66,64,62,62,63,63,63,59,71,69,66,66,66,66,64,62,62,62,62,59,66,66,64,62,62,62,64,64,66,66,64,61,61,62,59,59,59,59,47,47,59,57,54,54,54,54,54,47,47,47,47,47,47,47,59,59,71,69,66,66,66,66,67,66,66,64,62,62,63,63,63,47,59,57,54,54,54,54,52,50,50,50,50,47,54,54,52,50,50,62,64,64,66,66,64,61,61,62,59,59,59,59,59,59,59,59,59,59,50,50,50,50,50,50,50,50,50,50,49,49,50,50,52,52,49,49,49,49,49,49,51,51,51,51,52,52,54,54,54,54,52,52,50,50,47,47,50,50,50,50,47,47,50,50,52,52,49,49,45,45,42,42,47,47,47,47,47,47,47,47,47,47,50,50,50,50,50,50,50,50,50,50,49,49,50,50,52,52,49,49,49,49,49,49,51,51,51,51,52,52,54,54,57,57,55,55,62,62,61,61,57,57,57,57,54,54,57,57,54,54,52,52,50,50,49,49,47,47,47,47,47,47,47,47,47,47,47,47,47,50,54,54,50,50,59,59,59,62,66,66,62,62,49,49,49,52,54,52,49,50,59,59,59,62,59,57,54,57,47,47,50,50,54,54,50,50,62,62,62,66,66,66,66,66,49,49,49,54,50,50,49,49,59,59,59,62,59,59,57,57,47,47,47,50,54,54,50,50,59,59,59,62,66,66,62,62,49,49,49,52,54,54,52,52,61,61,61,61,61,57,57,57,47,47,47,50,54,54,50,50,59,59,59,62,66,66,62,62,50,50,54,54,52,52,57,57,57,57,47,47,59,57,54,54,54,54,54,47,47,47,47,47,47,47,59,59,71,69,66,66,66,66,67,66,66,64,62,62,63,63,63,47,59,57,54,54,54,54,52,50,50,50,50,47,54,54,52,50,50,62,64,64,66,66,64,61,61,62,59,59,59,59,59,59,71,69,66,66,66,66,66,59,59,59,59,59,59,59,47,47,59,57,54,54,54,54,55,54,54,52,50,50,51,51,51,59,71,69,66,66,66,66,64,62,62,62,62,59,66,66,64,62,62,50,52,52,54,54,52,49,49,50,47,47,47,47,47,47,47,47,47,47,62,62,62,62,62,62,62,62,62,62,61,61,62,62,64,64,61,61,61,61,61,61,63,63,63,63,64,64,66,66,66,66,64,64,62,62,59,59,62,62,62,62,59,59,62,62,64,64,61,61,57,57,54,54,59,59,59,59,59,59,59,59,59,59,62,62,62,62,62,62,62,62,62,62,61,61,62,62,64,64,61,61,61,61,61,61,63,63,63,63,64,64,66,66,69,69,73,73,74,74,73,73,69,69,69,69,66,66,69,69,66,66,64,64,62,62,61,61,59,59,59,59,59,59,59,59,59,59]
n_{b}=[38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,38,38,38,38,38,38,38,38,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,33,33,33,33,33,33,33,33,35,35,35,35,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,38,38,38,38,38,38,38,38,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,38,38,38,38,38,38,38,38,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,33,33,33,33,33,33,33,33,35,35,35,35,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,38,38,38,38,38,38,38,38,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,33,33,33,33,33,33,33,33,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,40,40,40,40,40,40,40,40,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,40,40,40,40,40,40,40,40,35,35,35,35,35,35,35,35]
p=\operatorname{floor}\left(\operatorname{mod}\left(p_{o},\operatorname{length}\left(n_{a}\right)\right)t\right)
t=1
u=-1\cdot g
g=24
c_{a}=n_{a}\left[p\right]+g
c_{b}=n_{b}\left[p\right]+g
\operatorname{tone}\left(2^{\left(\frac{c_{a}}{12}+3\right)}\right)
\operatorname{tone}\left(2^{\left(\frac{c_{b}}{12}+3\right)}\right)
y=\frac{n_{a}\left[x+p\right]}{3}-17
y=\frac{n_{b}\left[x+p\right]}{3}-17
|
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | import os os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" import math import pygame def update(balls, surface): surface.fill(pygame.Color('white')) for i in balls: i.render(surface) pygame.display.update() class moment: def __init__(self, vxa, vya, vxb, vyb, ma, mb, dx, dy): self.vxa = vxa self.vya = vya self.vxb = vxb self.vyb = vyb self.ma = ma self.mb = mb self.dx = dx self.dy = dy self.va = math.hypot(vxa, vya) self.vb = math.hypot(vxb, vyb) self.ta = math.pi/2 if vxa==0 else math.atan(vya / vxa) self.tb = math.pi/2 if vxb==0 else math.atan(vyb / vxb) self.c = math.pi/2 if dx==0 else math.atan(dy / dx) if vxa<=0: self.ta = self.ta +math.pi if vxb<=0: self.tb = self.tb+math.pi #if dx<0: self.c = self.c+math.pi class ball: def __init__(self, dx, dy, vx, vy, color, size): self.dx = dx self.dy = dy self.vx = vx self.vy = vy self.color = color self.size = size self.mass = size**2 def tick(self): newX= self.dx + self.vx newY= self.dy + self.vy if (newX - self.size < 0) or (newX + self.size > 500): self.vx *= -1 elif (newY - self.size < 0) or (newY + self.size > 500): self.vy *= -1 else: self.dx = newX self.dy = newY def detect(self, other): distance = math.hypot(self.dx - other.dx, self.dy - other.dy) if distance < self.size + other.size: self.collide(other) def collide(self, other): col=moment(self.vx, self.vy, other.vx, other.vy, self.mass, other.mass, self.dx-other.dx, self.dy-other.dy) self.vx = (col.va * math.cos(col.ta - col.c) * (col.ma - col.mb) * math.cos(col.c)) + (2 * col.mb * col.vb * math.cos(col.tb - col.c) * math.cos(col.c)) / (col.ma + col.mb) + (col.va * math.sin(col.ta - col.c) * math.cos(math.pi/2 + col.c)) self.vy = (col.va * math.cos(col.ta - col.c) * (col.ma - col.mb) * math.sin(col.c)) + (2 * col.mb * col.vb * math.cos(col.tb - col.c) * math.sin(col.c)) / (col.ma + col.mb) + (col.va * math.sin(col.ta - col.c) * math.sin(math.pi/2 + col.c)) other.vx = (col.vb * math.cos(col.tb - col.c) * (col.mb - col.ma) * math.cos(col.c)) + (2 * col.ma * col.va * math.cos(col.ta - col.c) * math.cos(col.c)) / (col.mb + col.ma) + (col.vb * math.sin(col.tb - col.c) * math.cos(math.pi/2 + col.c)) other.vy = (col.vb * math.cos(col.tb - col.c) * (col.mb - col.ma) * math.sin(col.c)) + (2 * col.ma * col.va * math.cos(col.ta - col.c) * math.sin(col.c)) / (col.mb + col.ma) + (col.vb * math.sin(col.tb - col.c) * math.sin(math.pi/2 + col.c)) #1d #self.vx = (col.ma * col.vxa - col.mb * col.vxa + 2 * col.mb * col.vxb) / (col.ma + col.mb) #other.vx = (col.mb * col.vxb - col.ma * col.vxb + 2 * col.ma * col.vxa) / (col.mb + col.ma) #energy lost #print(((self.vx**2 + self.vy**2) * self.mass + (other.vx**2 + other.vy**2) * other.mass)- (col.va**2 * col.ma + col.vb**2 * col.mb)) def render(self, surface): pygame.draw.circle(surface, pygame.Color('black'), [int(self.dx), int(self.dy)], self.size) pygame.draw.circle(surface, pygame.Color(self.color), [int(self.dx), int(self.dy)], self.size-2) pygame.init() surface = pygame.display.set_mode((500,500)) pygame.display.set_caption('Balls') balls=[ ball(50,50,.5,.5, 'red', 50), ball(350,350,-2,-2, 'blue', 50), ball(50,350,0,-2, 'yellow', 50), ball(350,50,-.2,1.5, 'green', 50), ball(250,250,.4,2, 'purple', 50), ] while 1: for i in range(0,len(balls)): balls[i].tick() for j in range(i+1,len(balls)): balls[i].detect(balls[j]) update(balls, surface) pygame.time.wait(10) |

submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | morse = Dict('A'=>".-",'B'=>"-...",'C'=>"-.-.",'D'=>"-..",'E'=>".",'F'=>"..-.",'G'=>"--.",'H'=>"....",'I'=>"..",'J'=>".---",'K'=>"-.-",'L'=>".-..",'M'=>"--",'N'=>"-.",'O'=>"---",'P'=>".--.",'Q'=>"--.-",'R'=>".-.",'S'=>"...",'T'=>"-",'U'=>"..-",'V'=>"...-",'W'=>".--",'X'=>"-..-",'Y'=>"-.--",'Z'=>"--..",'a'=>".-",'b'=>"-...",'c'=>"-.-.",'d'=>"-..",'e'=>".",'f'=>"..-.",'g'=>"--.",'h'=>"....",'i'=>"..",'j'=>".---",'k'=>"-.-",'l'=>".-..",'m'=>"--",'n'=>"-.",'o'=>"---",'p'=>".--.",'q'=>"--.-",'r'=>".-.",'s'=>"...",'t'=>"-",'u'=>"..-",'v'=>"...-",'w'=>".--",'x'=>"-..-",'y'=>"-.--",'z'=>"--..",'0'=>"-----",'1'=>".----",'2'=>"..---",'3'=>"...--",'4'=>"....-",'5'=>".....",'6'=>"-....",'7'=>"--...",'8'=>"---..",'9'=>"----.",'.'=>".-.-.-",','=>"--..--",':'=>"---...",';'=>"-.-.-.",'?'=>"..--..",'\''=>".----.",'!'=>"-.-.--",'('=>"-.--.",')'=>"-.--.-",'/'=>"-..-.",'-'=>"-....-",' '=>" ",)
println("Enter your message:")
message = readline()
translated = ""
for i in message
global translated *= (get(morse, i, "") * " ")
end
println(translated)
for i in translated
if i == '.'
println(".\007")
sleep(.25)
elseif i == '-'
println("-\007")
sleep(.75)
elseif i == ' '
sleep(1)
end
end
|
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | local folder = script.Parent local Players = game:GetService("Players") local vx = nil local vy = nil local vz = nil local mass = nil local dif = nil local rad = nil local move = nil local cons = 5 game:GetService("RunService").Heartbeat:Connect(function(deltaTime) for _, myself in pairs(folder:GetChildren()) do if myself~=script then vx=myself:GetAttribute("vx") vy=myself:GetAttribute("vy") vz=myself:GetAttribute("vz") mass=myself:GetAttribute("mass") for _, other in pairs(folder:GetChildren()) do if other~=myself and other~=script then dif = other.Position - myself.Position rad = math.sqrt(dif.X^2 + dif.Y^2 + dif.Z^2) vx = vx + (deltaTime * cons * other:GetAttribute("mass") * dif.X / (rad^3)) vy = vy + (deltaTime * cons * other:GetAttribute("mass") * dif.Y / (rad^3)) vz = vz + (deltaTime * cons * other:GetAttribute("mass") * dif.Z / (rad^3)) end end myself.Position = myself.Position + Vector3.new(vx * deltaTime, vy * deltaTime, vz * deltaTime) if myself.Name=="spawn" then for _, player in Players:GetPlayers() do player.Character:WaitForChild("HumanoidRootPart").Position = myself.position + Vector3.new(0,(myself.Size.Y), 0) end end myself:SetAttribute("vx", vx) myself:SetAttribute("vy", vy) myself:SetAttribute("vz", vz) end end end) |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 | :Disp "-I0
:Disp "-I2
:Disp "-J0
:Disp "-I5
:Disp "-J4
:
:For(X,1,10
:For(Y,1,10
:Disp sub("ABCDEFGHIJ",X,1)+sub("0123456789",Y,1
:Input Z
:End
:End
:End
|
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; public class circle extends PApplet { int psize = 500; double x; double y; double theta; int depth = 10; int dots = 200; long fact; public void settings(){ size(psize, psize); } public void setup(){ for (int i = 0; i < dots; i++) { theta = i * 2 * Math.PI / dots; x = 0; y = 0; for (int n = 0; n < depth; n++){ fact = 1; for (int k = 2*n; k > 0; k-=1) fact *=k; x+= Math.pow(-1, n) * Math.pow(theta, 2 * n) / fact; y+= Math.pow(-1, n) * Math.pow(theta, 2 * n + 1) / fact / (2 * n + 1); } ellipse((int)((x * 0.9f + 1) * (psize / 2)), (int)((y * 0.9f + 1) * (psize / 2)), (int) (psize / 100), (int) (psize / 100)); } } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "circle" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } } |
submitted at
0 likes
1 | =IF(ROW()=1, 1, IF(COUNTIF(INDIRECT("A1"):INDIRECT("A"&ROW()-1), MAX(INDIRECT("A1"):INDIRECT("A"&ROW()-1)))<INDIRECT("A"&MAX(INDIRECT("A1"):INDIRECT("A"&ROW()-1))), MAX(INDIRECT("A1"):INDIRECT("A"&ROW()-1)), MAX(INDIRECT("A1"):INDIRECT("A"&ROW()-1))+1))
|
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | use std::io; fn main() { println!("This is a full recreation of the official Warrior Cats clan quiz. https://web.archive.org/web/20140413215631/http://www.warriorcats.com/games-and-extras/extras/starclan-clanname "); let questions = vec![ "1. Following the rules is important to you", "2. You like decorating your room with posters and stickers", "3. Your friends consider you a fast runner", "4. If a classmate was unfairly accused of cheating you would help defend their reputation", "5. You prefer to keep to yourself", "6. If at first you don't succeed, try, try again", "7. During the summer you like to spend as much time swimming as possible", "8. You like to stay up late at night", "9. You snooze, you lose", "10. You can easily sneak up on a friend without them hearing", "11. You enjoy board games and cross-word puzzles", "12. You would always rather be outside in the fresh air", "13. If you were at a theme park with your friends, you would be the first try the scariest roller coaster", "14. You dream of one day owning a boat", "15. You prefer to wear black over any other color", "16. Loyalty in a friendship is very important to you This is your last question. Time to consult StarClan"]; let clans = vec![ "Based on your answers, StarClan has determined your belong in ThunderClan. You are a member of the ThunderClan. You are brave and loyal and will always stand up for what is right.", "Based on your answers, StarClan has determined your belong in RiverClan. You are a member of the RiverClan. You are clever and graceful and love the beauty of water.", "Based on your answers, StarClan has determined your belong in WindClan. You are a member of the WindClan. You are swift and loyal and love being outside to smell the fresh air.", "Based on your answers, StarClan has determined your belong in ShadowClan. You are a member of the ShadowClan. You are ambitious and proud and enjoy being independent."]; let key = vec![0, 1, 2, 0, 3, 2, 1, 3, 3, 0, 1, 2, 0, 1, 3, 2]; loop{ println!("Answer these questions to find out what Clan StarClan thinks you belong in"); let mut score = vec![0, 0, 0, 0]; let mut answer = String::new(); for question in 0..16 { println!("{}", questions[question]); loop{ println!("Please answer 1 (Strongly Disagree), 2 (Disagree), 3 (Neutral), 4 (Agree), or 5 (Strongly Agree)"); answer = String::new(); io::stdin().read_line(&mut answer); if answer.trim() == "1"{score[key[question]] = score[key[question]]-2; break;} if answer.trim() == "2"{score[key[question]] = score[key[question]]-1; break;} if answer.trim() == "3"{break;} if answer.trim() == "4"{score[key[question]] = score[key[question]]+1; break;} if answer.trim() == "5"{score[key[question]] = score[key[question]]+2; break;} } } let mut win = 0; for i in 1..4 { if score[i] > score[win]{win = i;} } let mut result = clans[win]; for i in 0..4 { if score[i] == score[win] && i!=win{result = "StarClan is unable to determine your clan at this time. Try again. ";} } println!("{}", result); if result.starts_with("Based"){break;} } } |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import os import requests t='bottoken' c='channelid' n='The Most Wanted Person In The United States.mp3' f=open(n,'rb') h={'authorization' :'Bot '+t} s=os.path.getsize(n) u='https://discord.com/api/v10/channels/'+str(c)+'/messages' a='https://discord.com/api/v10/channels/'+str(c)+'/attachments' l={"files":[{"filename":n,"file_size":s,"id":"0"}]} r=requests.post(a,headers=h,json=l) o=r.json()['attachments'][0]['upload_url'] m=r.json()['attachments'][0]['upload_filename'] d={'Content-Length':str(s),'Connection':'keep-alive','Content-Type':'audio/mp3','authorization' :'Bot '+t} p=requests.put(o,headers=d,data=f) i={"attachments":[{"id":"0","filename":n,"uploaded_filename":m}]} p=requests.post(u,headers=h,json=i) f.close() |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | <!DOCTYPE html> <html> <head> <title>CG 73</title> </head> <body> <p id='chatbox' style='font-family: monospace;position:absolute;bottom:20px;'></p> <span style='position:absolute;bottom:5px;'> <input type='text' id='typebox' placeholder='type here!'> </input> </span> </body> <script> document.getElementById('typebox').onkeydown = function (e) {if (e.key == 'Enter') { send(); }}; function datasend(socket, data) {socket.send(JSON.stringify(data))} var wsurl = 'wss://codeguessing.gay/73/ws'; let socket = new WebSocket(wsurl); socket.onerror = function() {window.alert('ERROR CONNECTING TO SERVER')} socket.onmessage = function (message) { console.log(message.data) returndata = JSON.parse(message.data); name = returndata['name'] color = name.slice(0,name.indexOf('_')); if (returndata['reason'] == 'connect') { newtext=('<b><span style="color:'+color+';">'+name+' connected'+'</span></b><br>') write(newtext)} if (returndata['reason'] == 'disconnect') { newtext=('<b><span style="color:'+color+';">'+name+' disconnected'+'</span></b><br>') write(newtext)} if (returndata['reason'] == 'message') { newtext=('<b><span style="color:'+color+';">'+name+'</span></b> '+returndata['content']+'<br>') write(newtext)} } function write(newtext){ document.getElementById('chatbox').innerHTML=document.getElementById('chatbox').innerHTML+newtext; } function send() { message=document.getElementById("typebox").value if (message!=''){ document.getElementById("typebox").value=''; var newmessage = {'content': message} datasend(socket, newmessage)} } </script> |
submitted at
0 likes
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | coded_message = "mrrp mrrrp meow meow mew meow :3" frequency_dict = {} for character in coded_message: if character in frequency_dict: frequency_dict[character]+= 1 else: frequency_dict[character]= 1 sorted_key = [] sorted_val = [] for character in frequency_dict: pointer = 0 for i in sorted_key: if frequency_dict[i] < frequency_dict[character]: pointer+=1 else: break sorted_key.insert(pointer, character) sorted_val.insert(pointer, frequency_dict[character]) encoded_key = {i:"" for i in frequency_dict} for i in range(0, len(frequency_dict)-1): first_key = sorted_key.pop(0) first_val = sorted_val.pop(0) second_key = sorted_key.pop(0) second_val = sorted_val.pop(0) for character in second_key: encoded_key[character]="0"+encoded_key[character] for character in first_key: encoded_key[character]="1"+encoded_key[character] new_key = first_key+second_key new_val = first_val+second_val pointer = 0 for i in sorted_val: if i < new_val: pointer+=1 else: break sorted_key.insert(pointer, new_key) sorted_val.insert(pointer, new_val) encoded_message = "" for character in coded_message: encoded_message += encoded_key[character] print(encoded_message) for character in encoded_key: print(character + "\t" + encoded_key[character]) |
submitted at
1 like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | async function go(dir, num) {for (let i = 0; i < num; i++) { //await fetch("/extra/game70", { method: "POST", body: JSON.stringify({dir}), headers, }); fetch("/extra/game70", {method: "POST", body: JSON.stringify({dir}), headers, }); }} async function get() { grabbed = await fetch("/extra/game70", {method: "GET", headers,}); grid = await grabbed.json(); return await grid['grid']; } for (let i = 0; i < 3000; i++) { grid = await get(); px = grid.indexOf('@') % 16; py = Math.floor(grid.indexOf('@') / 16); gx = grid.indexOf('+') % 16; gy = Math.floor(grid.indexOf('+') / 16); kx = grid.indexOf('*') % 16; ky = Math.floor(grid.indexOf('*') / 16); console.log(px, py, gx, gy, kx, ky); if (ky != py) { await go(px < gx ? 'right' : 'left', Math.abs(px - gx)); await go(py < gy ? 'down' : 'up', Math.abs(py - gy)); } else { await go(py < gy ? 'down' : 'up', Math.abs(py - gy)); await go(px < gx ? 'right' : 'left', Math.abs(px - gx)); } } |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include <iostream> #include <cmath> using namespace std; int main() { double iterations = 10000; cout << "Enter a positive value:" << endl; double target; double result; cin >> target; cout << "Target value: " << target << endl << endl; double final_a = 0; double final_b = 1; double final_result = 1.0; for (int a = 0; a < iterations; a++) { for (int b = 1; b < iterations; b++) { double result = exp(a) / b; if (abs(target - result) < abs(target - final_result)) { final_a = a; final_b = b; final_result = result; } } } cout << "e^" << final_a << "/" << final_b << "=" << final_result << endl; cout << abs(target - final_result) << " from target value" << endl << endl; final_a = 1; final_b = 1; final_result = M_PI; for (int a = 1; a < iterations; a++) { for (int b = 1; b < iterations; b++) { double result = a * M_PI / b; if (abs(target - result) < abs(target - final_result)) { final_a = a; final_b = b; final_result = result; } } } cout << final_a << "π/" << final_b << "=" << final_result << endl; cout << abs(target - final_result) << " from target value" << endl <<endl; } |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #this code doesnt actually work 😇 cm = 'Uif rvjdl cspxo gpy kvnqt pwfs uif mbaz eph.' wlf = open('wordlist.txt', 'r') wl = wlf.read().split('\n') wlf.close() abc='abcdefghijklmnopqrstuvwxyz' punct=['!','.','-',',',';','?','\n','\t'] wld={} cfd={i:1 for i in abc} for i in wl: for c in i: if not c.lower() in abc: break else: if len(i) in wld: wld[len(i)].append(i.lower()) else: wld[len(i)]=[i.lower()] for c in i: cfd[c]+=1 cm=cm.lower() for i in punct: cm=cm.replace(i, '') cms = set(list(cm.replace(' ',''))) cml = cm.split(' ') fwd={i:{j:0 for j in abc} for i in cms} for w in cml: for p in wld[len(w)]: cd = {} for c in range(0, len(w)): if w[c] in cd: if cd[w[c]]==p[c]: continue else: break else: cd[w[c]]=p[c] else: for j in cd: fwd[j][cd[j]]+=1 iwd={i:'a' for i in cms} for i in cms: for j in fwd[i]: if (fwd[i][j]/cfd[j])>(fwd[i][iwd[i]]/cfd[iwd[i]]): #if (fwd[i][j])>(fwd[i][iwd[i]]): iwd[i]=j ncm=list(cm.lower()) for i in range(0,len(ncm)): if ncm[i] in iwd: ncm[i]=iwd[ncm[i]] ncm = ''.join(ncm) print(ncm) |
post a comment