#β¨ Programming
1 messages Β· Page 3 of 1
@graceful viper I got a coding challenge for you (if you are still asking for coding challenge or problem or whatever thingy)
Sure
how about the kangaroo challenge or at least that is what my school's material called it
the kangaroo can long jump over a distance x or short (?) jump over a distance y. What is the least number of jumps that is required for the kangaroo to cover exactly z distance
Input format
x y z
Example
Input
349 153 2706
Output
10
I have done this before
Ez
yeah
I found the code
that is in the training material for this year competition
In my
Documents
x, y, z = map(int, input().split())
Determine the number of long jumps and short jumps required to cover the distance z
long_jumps = z // x
remaining_distance = z - long_jumps * x
short_jumps = remaining_distance // y
Adjust the number of long jumps and short jumps if necessary to cover the distance exactly
if remaining_distance % y != 0:
short_jumps += 1
remaining_distance -= y
if remaining_distance > 0:
long_jumps += 1
Output the total number of jumps required
total_jumps = long_jumps + short_jumps
print(total_jumps)
because I abused the python function thingy
;-;
you keep your code?
What?
I write code in a test.c in /tmp and delete it after submitting
huh interesting
Whats the uptime of ur pc
More than 24 hours?
I bet
most of the time
Show rn
lol
I like contributing computing power to something useful
like stockfish testing because I like stockfish
i think my record is around a month
i just switched distros so i need to restart a bit to get everything set up
@molten barn is this a bad way to do what i want?
var hitcircle: Image
var hitcircle_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle = readImage(folder_path & "/[email protected]")
hitcircle_HD = true
elif fileExists(folder_path & "/hitcircle.png"):
hitcircle = readImage(folder_path & "/hitcircle.png")
hitcircle_HD = false
else:
echo "No 'hitcircle(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
i just want to assign a variable if the file exists, if not try the lower res, if not, tell them and prompt the user to close the program
you could maybe use a loop
not sure how that will benefit for performance though
since its not really "compute"
so this is fine?
yeh
i thought i might have overcomplicated it
its just a if elif else ladder
what i have so far:
import os_files/dialog
import os
import pixie
import system
import std/parsecfg
var folder_dialog: DialogInfo
folder_dialog.kind = dkSelectFolder
folder_dialog.title = "Select Skin Folder"
folder_dialog.folder = getHomeDir()
let folder_path = folder_dialog.show()
var skin_ini: Config
if fileExists(folder_path & "/skin.ini"):
skin_ini = loadConfig("skin.ini")
else:
echo "No 'skin.ini' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle: Image
var hitcircle_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle = readImage(folder_path & "/[email protected]")
hitcircle_HD = true
elif fileExists(folder_path & "/hitcircle.png"):
hitcircle = readImage(folder_path & "/hitcircle.png")
hitcircle_HD = false
else:
echo "No 'hitcircle(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle_overlay: Image
var hitcircle_overlay_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle_overlay = readImage(folder_path & "/[email protected]")
hitcircle_overlay_HD = true
elif fileExists(folder_path & "/hitcircleoverlay.png"):
hitcircle_overlay = readImage(folder_path & "/hitcircleoverlay.png")
hitcircle_overlay_HD = false
else:
echo "No 'hitcircleoverlay(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
pixie is a yummy image package
stole my name wtf
"2D graphics library"
i want to have this functionality though
echo "No 'hitcircleoverlay(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
and this makes it easier to read
any easier way to do let ch = readChar(stdin)?
set initial values for variables
so
var hitcircle = folder_path & "/[email protected]"
and then if not just exit?
that seems a better
you atleast expect the end user to have a non hd image right?
DON'T USE PARSECFG for the love of god
what should i use 
An alternative parsecfg configuration parser for Nim. - GitHub - Aetopia/CfgParser: An alternative parsecfg configuration parser for Nim.
i made an alternative
and i also explain the reasons why i made it an alternative
tldr is fucks up with the key value pair itself
nope
just copy the file contents from src and paste them into a new file
π
parsecfg does this
NamedCounts=(("DiscoveryLobbyMatchmakingPlay", 23),("DiscoveryLobbyMatchmakingPlay_HotfixVer", 0),("lastfrontendflow_Fortnite", 23),("lastfrontendflow_Fortnite_HotfixVer", 0),("UEnableMultiFactorModal::ShouldShowMFASplashScreen", 23),("UEnableMultiFactorModal::ShouldShowMFASplashScreen_HotfixVer", 0),("FrontendContext:ShouldShowSocialImport", 23),("FrontendContext:ShouldShowSocialImport_HotfixVer", 0)) <- what is passed
output -> namedcounts="""(("DiscoveryLobbyMatchmakingPlay", 23),("DiscoveryLobbyMatchmakingPlay_HotfixVer", 0),("lastfrontendflow_Fortnite", 23),("lastfrontendflow_Fortnite_HotfixVer", 0),("UEnableMultiFactorModal::ShouldShowMFASplashScreen", 23),("UEnableMultiFactorModal::ShouldShowMFASplashScreen_HotfixVer", 0),("FrontendContext:ShouldShowSocialImport", 23),("FrontendContext:ShouldShowSocialImport_HotfixVer", 0))"""
weird
fatal.nim(54) sysFatal
Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]
?????????????
import os_files/dialog
import os
import pixie
import system
import cfgparser
var folder_dialog: DialogInfo
folder_dialog.kind = dkSelectFolder
folder_dialog.title = "Select Skin Folder"
folder_dialog.folder = getHomeDir()
let folder_path = folder_dialog.show()
var skin_ini: Cfg
if fileExists(folder_path & "/skin.ini"):
skin_ini = loadCfg("skin.ini")
else:
echo "No 'skin.ini' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle: Image
var hitcircle_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle = readImage(folder_path & "/[email protected]")
hitcircle_HD = true
elif fileExists(folder_path & "/hitcircle.png"):
hitcircle = readImage(folder_path & "/hitcircle.png")
hitcircle_HD = false
else:
echo "No 'hitcircle(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle_overlay: Image
var hitcircle_overlay_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle_overlay = readImage(folder_path & "/[email protected]")
hitcircle_overlay_HD = true
elif fileExists(folder_path & "/hitcircleoverlay.png"):
hitcircle_overlay = readImage(folder_path & "/hitcircleoverlay.png")
hitcircle_overlay_HD = false
else:
echo "No 'hitcircleoverlay(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
should hitcircle type even be Image?
why tf did you import system
what is the pixie module
i forgot
send or show interop code
i think its cfgparser.nim
cause i only have 50 lines
?
show entire error message
fatal.nim(54) sysFatal
Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect]
import os_files/dialog
import os
import pixie
import cfgparser
var folder_dialog: DialogInfo
folder_dialog.kind = dkSelectFolder
folder_dialog.title = "Select Skin Folder"
folder_dialog.folder = getHomeDir()
let folder_path = folder_dialog.show()
var skin_ini: Cfg
if fileExists(folder_path & "/skin.ini"):
skin_ini = loadCfg("skin.ini", case_sensitive = true, delimiter = ':', comments = [';'])
else:
echo "No 'skin.ini' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle: Image
var hitcircle_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle = readImage(folder_path & "/[email protected]")
hitcircle_HD = true
elif fileExists(folder_path & "/hitcircle.png"):
hitcircle = readImage(folder_path & "/hitcircle.png")
hitcircle_HD = false
else:
echo "No 'hitcircle(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
var hitcircle_overlay: Image
var hitcircle_overlay_HD: bool
if fileExists(folder_path & "/[email protected]"):
hitcircle_overlay = readImage(folder_path & "/[email protected]")
hitcircle_overlay_HD = true
elif fileExists(folder_path & "/hitcircleoverlay.png"):
hitcircle_overlay = readImage(folder_path & "/hitcircleoverlay.png")
hitcircle_overlay_HD = false
else:
echo "No 'hitcircleoverlay(@2x).png' found!\nPress any key to exit..."
let ch = readChar(stdin)
quit(0)
this line of cfgparser is fucking it up
keyvalue = line.split(delimiter, 1)
proc loadCfg*(str: string, caseSensitive: bool = true,
delimiter: char = '=', comments: openArray[char] = [';']): Cfg =
var
cfg = newCfg()
section: string
# Create a reserved section.
cfg[""] = newOrderedTable[string, string]()
for i in str.splitLines():
let line = i.strip()
if line.len == 0 or comments.contains(line[0]): continue
# Parse the section.
elif [line[0], line[^1]] == ['[', ']']:
section = line.strip(chars = {'[', ']', ' '})
if not case_sensitive: section = section.toLower()
cfg[section] = newOrderedTable[string, string]()
else:
let
keyvalue = line.split(delimiter, 1)
key = keyvalue[0].strip()
value = keyvalue[1].strip()
if key != "" or value != "":
if not case_sensitive: cfg[section][key.toLower()] = value
else: cfg[section][key] = value
return cfg
show me what are you trying to parse
oh wow
something like this
//Formatted by ck // pepega tools // cyperdark#6890
[General]
Name: - γCKγ Bacon boi 1.0 γclrsγ - lite
Author: cyperdark
Profile: https://osu.ppy.sh/users/9893708
β=====================================β
β Downloaded from https://ck1t.ru/ss β===============β
β Skin https://ck1t.ru/s-- γCKγ Bacon boi 1.0 β
β=====================================================β
Version: 2.5
AnimationFramerate: 60
// βββββ Cursor βββββ \\
CursorCentre: 1
CursorExpand: 0
CursorRotate: 0
CursorTrailRotate: 0
// βββββ Combo bursts βββββ \\
ComboBurstRandom: 0
HitCircleOverlayAboveNumber: 0
// βββββ Slider βββββ \\
AllowSliderBallTint: 1
SliderBallFlip: 1
SliderStyle: 2
[Colours]
// βββββ Combo Colors βββββ \\
Combo1: 255, 255, 255 // #ffffff
Combo2: 255, 114, 111 // #FF726F
MenuGlow: 82, 74, 71 // #524a47
InputOverlayText: 255, 255, 255 // #ffffff
SliderBorder: 200,200,200
SliderTrackOverride: 20, 18, 17 // #141211
// βββββ Song Select βββββ \\
SongSelectActiveText: 255, 255, 255 // #ffffff
SongSelectInactiveText: 255, 255, 255 // #ffffff
SpinnerBackground: 255, 255, 255 // #ffffff
[Fonts]
// βββββ HitCircle βββββ \\
HitCirclePrefix: default
HitCircleOverlap: 25
// βββββ Score βββββ \\
ScorePrefix: numbers
ScoreOverlap: 10
// βββββ Combo βββββ \\
ComboPrefix: numbers
ComboOverlap: 10
wats wrong
you need to customize the parser
change the delimiter and comments array
did i not?
also the parser doesn't support on line comments
skin_ini = loadCfg("skin.ini", case_sensitive = true, delimiter = ':', comments = [';'])
comments = [';']
π€¦ββοΈ
where is //
yeah ik
char, comments: array[0..0, string]>
but expected one of:
proc loadCfg(str: string; caseSensitive: bool = true; delimiter: char = '=';
comments: openArray[char] = [';']): Cfg
first type mismatch at position: 4
required type for comments: openArray[char]
but expression 'comments = ["//"]' is of type: array[0..0, string]
expression: loadCfg("skin.ini", case_sensitive = true, delimiter = ':', comments = ["//"])
specify '/`
since it needs a char
when you need gigs of ram to edit text
nvm my parser is fucking up
just gonna use parsecfg
or you can implement your own to reduce bloat
@graceful viper linux can stay on for months lol
Look at servers for example
Windows server couldn't do that
It comes with a desktop
Lmao
And uwp apps
consumer linux desktops suck
Yeah
i agree
But it can still be somewhat stable for longer
I can't keep my pc on for more than 20 hours
windows server is the windows desktop is should have been
i can keep for than 2 days
without any lag or shit
ik linux is just way better than windows
try windows server 2022
im good
Lol
You could use gtk or pyqt to make it even more feature filled, with a menu bar and search bar, but thats not fun tbh. There are so many tutorials on that anyways and they all copy and paste stuff
Try adding a way to add website manager that adds and removes websites
That would be easy enough to do but would make the program so much more customizable and usable
why am i getting bullied
because you are gay
π π«΅
Jk
this server
supports all people from all walks of life
except for uziel
bloat
?
?
What
LOL
What meeded censored
Are you censoring ME?
NO
I FEEL
OPPRESSED
PPI
ELE APOIA A OPRESSΓO DAS MINORIAS
Yeah
I will add google analytics too it
So i can stalk you
And everyone who uses it
Ty
And it will he base64 encoded in ransomware python Encryption for super securityy1!1!1!
Lmao
Be more descriptive
can someone program me a program
no
can someone program me
Yes
can program someone for me
can someone program someone for me :(
no
Izzy is into you-
My attempt at writing heapsort
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare (const void *a, const void *b) {
if (*(unsigned int*)a == *(unsigned int*)b) return 0;
return (*(unsigned int*)a < *(unsigned int *)b) ? -1 : 1;
}
void siftDown (void *arr, const size_t start, const size_t end, const size_t size, int (*compar)(const void*, const void*), void *buffer) {
size_t root = start, child, swap;
while ((root << 1)+1 <= end) {
child = (root << 1)+1;
swap = root;
if (compar((char *)arr + size*swap, (char *)arr + size*child) < 0) {
swap = child;
}
if ((child+1 <= end) && (compar((char *)arr + size*swap, (char *)arr + size*(child + 1)) < 0)) {
swap = child + 1;
}
if (swap == root) {
return;
}
// root does not hold the largest element so swap root with swap
memcpy(buffer, (char *)arr + size*root, size);
memcpy((char *)arr + size*root,(char *)arr + size*swap, size);
memcpy((char *)arr + size*swap, buffer, size);
root = swap;
}
}
void heapsort (void *arr, const size_t nmemb, const size_t size, int (*compar)(const void*, const void*)) {
size_t end;
void *buffer = malloc(size);
for (size_t start = nmemb >> 1; start != 0; --start) siftDown(arr, start-1,nmemb-1,size, compar, buffer);
end = nmemb-1;
while (end != 0) {
// 0 now store the largest element
// swap 0 with end
memcpy(buffer, arr, size);
memcpy(arr,(char *)arr + size*end, size);
memcpy((char *)arr + size*end, buffer, size);
siftDown(arr, 0, --end, size, compar, buffer);
}
free(buffer);
}
int main () {
unsigned int arr[] = {10, 69, 78, 65, 25, 10, 4, 34, 56, 49};
heapsort(arr, 10, sizeof(unsigned int), compare);
for (unsigned int i = 0; i < 10; ++i) printf("%u ", arr[i]);
printf("\n");
return 0;
}
;compile
4 10 10 25 34 49 56 65 69 78
;compile
;compile
;compile
use ```c
for i in range(10000):
print(i)
;compile
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
;compile
0
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
;compile
while True: print("LLLL")
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
LLLL
;compile
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up snowz
shut the fuck up sno
I was trying to see how fast the algorithm is and it ran faster than the python script I use to print out random numbers
Hello
#include <stdlib.h>
#include <string.h>
int compare(const void *a, const void *b) {
return (*(const unsigned int*)a < *(const unsigned int*)b) ? -1 : 1;
}
void siftDown(void *arr, const size_t start, const size_t end, const size_t size, int (*compar)(const void*, const void*), void *buffer) {
size_t root = start, child, swap;
while ((root << 1) + 1 <= end) {
child = (root << 1) + 1;
swap = root;
if (compar(arr + size * swap, arr + size * child) < 0) {
swap = child;
}
if ((child + 1 <= end) && (compar(arr + size * swap, arr + size * (child + 1)) < 0)) {
swap = child + 1;
}
if (swap == root) {
return;
}
// root does not hold the largest element so swap root with swap
memcpy(buffer, arr + size * root, size);
memcpy(arr + size * root, arr + size * swap, size);
memcpy(arr + size * swap, buffer, size);
root = swap;
}
}
void heapsort(void *arr, const size_t nmemb, const size_t size, int (*compar)(const void*, const void*)) {
size_t end;
void *buffer = malloc(size);
if (!buffer) {
// handle allocation failure
}
for (size_t start = nmemb >> 1; start != 0; --start) {
siftDown(arr, start - 1, nmemb - 1, size, compar, buffer);
}
end = nmemb - 1;
while (end != 0) {
// 0 now store the largest element
// swap 0 with end
memcpy(buffer, arr, size);
memcpy(arr, arr + size * end, size);
memcpy(arr + size * end, buffer, size);
siftDown(arr, 0, --end, size, compar, buffer);
}
free(buffer);
}
int main() {
unsigned int arr[] = {10, 69, 78, 65, 25, 10, 4, 34, 56, 49};
heapsort(arr, 10, sizeof(unsigned int), compare);
for (size_t i = 0; i < 10; ++i) {
printf("%u ", arr[i]);
}
printf("\n");
return 0;
}```
;compile
Welp. python froze the computer when I try to generate 2**32 -1 numbers and got killed
;compile python
File "/app/output.s", line 5
int compare(const void *a, const void *b) {
^^^^^^^
SyntaxError: invalid syntax
fuck you
no that C
;compile c
4 10 10 25 34 49 56 65 69 78
don't you mean my code
wanna see i made something cool?
where is the edit?
;compile c
4 10 10 25 34 49 56 65 69 78
nvm
this is the same as u
i added error handeling
#include <stdlib.h>
#include <string.h>
int compare(const void *a, const void *b) {
if (*(const unsigned int*)a == *(const unsigned int*)b) {
return 0;
} else {
return (*(const unsigned int*)a < *(const unsigned int*)b) ? -1 : 1;
}
}
void siftDown(void *arr, const size_t start, const size_t end, const size_t size, int (*compar)(const void*, const void*), void *buffer) {
size_t root = start, child, swap;
while ((root << 1) + 1 <= end) {
child = (root << 1) + 1;
swap = root;
if (compar(arr + size * swap, arr + size * child) < 0) {
swap = child;
}
if ((child + 1 <= end) && (compar(arr + size * swap, arr + size * (child + 1)) < 0)) {
swap = child + 1;
}
if (swap == root) {
return;
}
// root does not hold the largest element so swap root with swap
memcpy(buffer, arr + size * root, size);
memcpy(arr + size * root, arr + size * swap, size);
memcpy(arr + size * swap, buffer, size);
root = swap;
}
}
void heapsort(void *arr, const size_t nmemb, const size_t size, int (*compar)(const void*, const void*)) {
size_t end;
void *buffer = NULL; // Declare buffer and initialize to NULL
buffer = malloc(size);
if (!buffer) {
fprintf(stderr, "Error: Memory allocation failed\n"); // Print error message
exit(EXIT_FAILURE); // Exit program with failure code
}
for (size_t start = nmemb >> 1; start != 0; --start) {
siftDown(arr, start - 1, nmemb - 1, size, compar, buffer);
}
end = nmemb - 1;
while (end != 0) {
// 0 now store the largest element
// swap 0 with end
memcpy(buffer, arr, size);
memcpy(arr, arr + size * end, size);
memcpy(arr + size * end, buffer, size);
siftDown(arr, 0, --end, size, compar, buffer);
}
free(buffer); // Free memory once sorting is done
}
int main() {
unsigned int arr[] = {10, 69, 78, 65, 25, 10, 4, 34, 56, 49};
heapsort(arr, 10, sizeof(unsigned int), compare);
for (size_t i = 0; i < 10; ++i) {
printf("%u ", arr[i]);
}
printf("\n");
return 0;
}```
where is 0?
when both are equal
you are gonna waste a swap like that?
it will always return either -1 or 1, but never 0, even if a and b are equal.
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare (const void *a, const void *b) {
if (*(size_t*)a == *(size_t*)b) return 0;
return (*(size_t*)a < *(size_t*)b) ? -1 : 1;
}
void siftDown (void *arr, const size_t start, const size_t end, const size_t size, int (*compar)(const void*, const void*), void *buffer) {
size_t root = start, child, swap;
while ((root << 1)+1 <= end) {
child = (root << 1)+1;
swap = root;
if (compar((char *)arr + size*swap, (char *)arr + size*child) < 0) {
swap = child;
}
if ((child+1 <= end) && (compar((char *)arr + size*swap, (char *)arr + size*(child + 1)) < 0)) {
swap = child + 1;
}
if (swap == root) {
return;
}
// root does not hold the largest element so swap root with swap
memcpy(buffer, (char *)arr + size*root, size);
memcpy((char *)arr + size*root,(char *)arr + size*swap, size);
memcpy((char *)arr + size*swap, buffer, size);
root = swap;
}
}
void heapsort (void *arr, const size_t nmemb, const size_t size, int (*compar)(const void*, const void*)) {
size_t end;
void *buffer = malloc(size);
for (size_t start = nmemb >> 1; start != 0; --start) siftDown(arr, start-1,nmemb-1,size, compar, buffer);
end = nmemb-1;
while (end != 0) {
// 0 now store the largest element
// swap 0 with end
memcpy(buffer, arr, size);
memcpy(arr,(char *)arr + size*end, size);
memcpy((char *)arr + size*end, buffer, size);
siftDown(arr, 0, --end, size, compar, buffer);
}
free(buffer);
}
int main () {
size_t len, i;
size_t *arr;
scanf("%zu", &len);
arr = malloc(len*sizeof(size_t));
for (i = 0; i < len; ++i) scanf("%zu", arr + i);
heapsort(arr, len, sizeof(size_t), compare);
for (i = 0; i < len; ++i) printf("%zu ", arr[i]);
printf("\n");
return 0;
}```
take array from input
and exactly the Discord character limit
lol
i made something cool
i gtg rn
i will show u when im back
?
but slightly formatting someone else's code does not really means that you made it
In the compare function, it might be possible to remove the equal check
Because my code only check if it is less than 0
But you would need to change the condition
Or not
a == b so a < b will fail and the output is 1
I wonder how does quicksort use the compar function
@dusty plover
yea sorry
my bad
My new creation
from scipy.integrate import solve_ivp
import plotly.graph_objects as go
def drag_force(vx, vy, vz, drag_coefficient, air_density, frontal_area):
v = np.sqrt(vx**2 + vy**2 + vz**2)
return -drag_coefficient * air_density * frontal_area * v / 2
def trajectory_with_air_resistance(t, y, drag_coefficient, air_density, frontal_area, g):
x, y, z, vx, vy, vz = y
dvx_dt = drag_force(vx, vy, vz, drag_coefficient, air_density, frontal_area) * vx
dvy_dt = drag_force(vx, vy, vz, drag_coefficient, air_density, frontal_area) * vy - g
dvz_dt = drag_force(vx, vy, vz, drag_coefficient, air_density, frontal_area) * vz
return [vx, vy, vz, dvx_dt, dvy_dt, dvz_dt]
def find_landing_point(result):
x_positions = result[0, :]
z_positions = result[2, :]
y_positions = result[1, :]
landing_index = np.argmax(y_positions <= 0)
return x_positions[landing_index], y_positions[landing_index], z_positions[landing_index]
def find_range(result):
x_positions = result[0, :]
y_positions = result[1, :]
landing_index = np.argmax(y_positions <= 0)
return x_positions[landing_index]
def plot_trajectory(angle, angle_z, time_of_flight, initial_speed, acceleration_due_to_gravity, drag_coefficient, air_density, frontal_area):
angle_rad = np.deg2rad(angle)
angle_z_rad = np.deg2rad(angle_z)
initial_speed_x = initial_speed * np.cos(angle_rad) * np.cos(angle_z_rad)
initial_speed_y = initial_speed * np.sin(angle_rad)
initial_speed_z = initial_speed * np.cos(angle_rad) * np.sin(angle_z_rad)
initial_conditions = [0, 0, 0, initial_speed_x, initial_speed_y, initial_speed_z]
sol = solve_ivp(trajectory_with_air_resistance, (0, time_of_flight), initial_conditions, args=(drag_coefficient, air_density, frontal_area, acceleration_due_to_gravity), dense_output=True)
time_array = np.linspace(0, time_of_flight, num=1000)
result = sol.sol(time_array)
return result
def update_figure(fig, result, name):
x_positions = result[0, :]
y_positions = result[1, :]
z_positions = result[2, :]
fig.add_trace(go.Scatter3d(x=x_positions, y=y_positions, z=z_positions, mode="lines", name=name))
return fig
def main():
num_trajectories = int(input("Enter the number of trajectories to compare: "))
trajectories = []
for i in range(num_trajectories):
angle = float(input(f"Enter the angle from the x-axis in degrees for trajectory {i + 1}: "))
angle_z = float(input(f"Enter the angle from the x-y plane in degrees for trajectory {i + 1}: "))
time_of_flight = float(input(f"Enter the time of flight in seconds for trajectory {i + 1}: "))
initial_speed = float(input(f"Enter the speed at which the projectile is being thrown in m/s for trajectory {i + 1}: "))
trajectories.append((angle, angle_z, time_of_flight, initial_speed))
acceleration_due_to_gravity = float(input("Enter the acceleration due to gravity in m/s^2: "))
drag_coefficient = float(input("Enter the drag coefficient: "))
air_density = float(input("Enter the air density in kg/m^3: "))
frontal_area = float(input("Enter the object's frontal area in m^2: "))
fig = go.Figure()
for i, (angle, angle_z, time_of_flight, initial_speed) in enumerate(trajectories):
result = plot_trajectory(angle, angle_z, time_of_flight, initial_speed, acceleration_due_to_gravity, drag_coefficient, air_density, frontal_area)
fig = update_figure(fig, result, f"Trajectory {i + 1}")
range_of_projectile = find_range(result)
print(f"Range of the Projectile for Trajectory {i + 1}: {range_of_projectile} m")
fig.update_layout(scene=dict(xaxis_title='X (m)', yaxis_title='Y (m)', zaxis_title='Z (m)'), title="Projectile Trajectories in 3D with Air Resistance")
fig.show()
if __name__ == "__main__":
main()```
Projectile Motion Visualizer
unnamed tuple abuse 
How to understand physics?
when I try to compute that is physics related like the transfer of momentum of a collision, my brain hurts
Understanding complicated concepts is not easy
The best way Iβve found for physics is seeing how real-world examples can relate to and prove parts of their equations
Simulations are useful for this
ok
;-;
How's the project
im gonna be honest ive never seen anything like this before
this is the biggest issue
other than that it's fine
its just a glorified text editor
yeah
im not adding all the options into checkboxes and stuff thats hella annoying π
I can do that
May I?
what gui lib did you use?
tkinter
May I do smoothie gui?
Oki
lmao i said the same thing before reading this
easy though, for option in section, make a check box thing
i would prefer to go rust
we want function not fanciness
We want
Aetopia
Not Spartan
Next Project: Smoothie GUI
Time to work
#π₯€ο½smoothie
does raw.githubusercontent.com work for you
Ayo
its messy af im not exprienced in coding at all so this is just like a practice thing for me but u can make one too the library is p easy to use
bloat though
unless sm-rs does need python
Aight I will do myself np
Yea?
i didnt make it to be official or anything just soemthing for myself
It's working fine
Imma make official
gl
To get vip tag
smoothie is not very fun to make a gui with
I like to make stupid stuff
Did you see this?
U know about projectile motion
no
Yk about projectile motion?
ive nevr taken physics
It's not an option here
Lmao
U have to take it
With bio also and with maths also
If you take commerce then only you are free
i think i have to aswell but not yet
idc about that crap
;((
Check my project
yeah lol i dont think i could fit all of that nicely in mine so i just have it like notepad
lol
i know its bad
but i will make it better
minen has this too kinda cool ig
how much time u took this to make?
it took me less than 1 hour to make this
like a few hours
What on earth
Donβt highlight the options like that
im not highlighting
just made light and dark mode
i will fix that shit
tell me this is better or
this
Itβs smaller and easier to navigate
all useful stuff is there right?
what things i can add?
Include all of the options but make the categories collapsable
then 1st one is better imo
First one is uglier
dont worry
it was raw
i will make it good
functinality wise
which one is good?
use customtkinter the deafult one is ugly π
using python is more uglier
eh python is decent for prototyping the smoothie gui
let ppl use what they like :)
rust is preferable
what should i use?
best option?
;)
learning shit
lol help me wait i made one more 2 mins finishing and sending u third prototype then i will try egui if i can use it lol why send here
i was spamming
looks good
i can add
if u say so
thats why i added dark mode in my gui
i never used smoothie in my life fr
eh would nice if you could do in any rust gui lib
couleur wants a cfg editor
hm
so key -> value pairs and such
uh
will take some times
but i will try my best
im trying to make a good gui first
then i will make it functinal with all buttons working
see this
eh could you statically size the window i.e remove the maximize button
clearly you are not resizing the ui elements according to the window size
bro
im asking about options
for any enable toggle make a checkbox
for any option that has multiple options a dropdown
for any option that has a range use a slider
bruh
tell me
all the options available there are ok
or i need to add any other?
like all the important ones
use whatever ui element that is relevant to a given option
the ui design looks clean and not crowded to me
but if you could club some settings together π€
like?
this in one section
pre interp also
encoding + timescale could its own section
everything else in misc
no point in doing this if its all just textboxes
it's still a glorified text editor just more separated and harder to use
me making trying to make sm-ui ποΈ
most of the sm settings aren't just arbitrary text
ik
i remember making a fully functional ui
they have specific options and all of those should be listed out
whose source is now lost to multiple windows reinstalls
only things like ffmpeg args should be textboxes really
oh and the mask paths too
ok tell me what things i should keep as text boxes
spartan
eh looks decent
now tell what to do
this is the tip
ffmpeg/ffprobe args and filepaths
actually everything under [output] and all filepaths
and the ff options in [miscellaneous]
oki
arbitrary textboxes are unintuitive because they're not explicit about what kind of input they want
but it's necessary for ffmpeg options and filepaths and stuff like that
wtf photo viewer can also uses colors WTF
atleast i have dark mode π§
see the bottom of the window
thats usually transparent or white
as far as i remember
dark titlebar tweak
shitass reg file if you are lazy to view #π£ο½the-tweak-tips
#π£ο½the-tweak-tips message
tweak tip link
i thought u did something else
nope
[flowblur]
mask: ...
[output]
process: ffmpeg
enc args: H264 CPU
file format: %FILENAME% ~ %FRUIT%
container: .MP4
[preview window]
process: ffplay
output args: -s 1280x720 -f yuv4mpegpipe -
[miscellaneous]
global output folder:
ffmpeg options: -loglevel error -i - -hide_banner -stats -stats_period 0.15
ffplay options: -loglevel quiet -i - -autoexit -window_title smoothie.preview
i meant
these are the only settings that require textboxes as far as i can see
oki
preview could be clubbed under misc btw
everything else can be a boolean checkbox or dropdown
you can use snapping sliders for numbers
this role LMFAO
or spinctrl
stop interrupting with random stuff
doing spinctrl
snapping sliders
hm
wait
oh yes'
thanks
yeah like sliders that snap to every 10/100 or smth
problem with spinctrl, the user can put any arbitrary value
depending on the value
ways to fix it?
adding checks for the value when its being entered
can u guys come
i.e is it a number
you closed the stream lmao
actually you need the rife model path too
under [pre interp]
can u join #916825646251012106
you could just have a dropdown that lists every folder under /models (the default directory) but it supports absolute paths too so
no
cutie come into vc
im at school + stop calling me a cutie wtf
lmao

not funny
yeah looks fine
may i show u all the tabs
what about combing a few tabs into one
the box with arrows or whatever is probably better than sliders for numbers tbh
like interp + frameblend + flowblur
i don't mind having them separate
would get cluttered quickly
yeh there is enough space though
interp + frameblend + flowblur in 1 tab would be too much probably
it's very hard to separate them cleanly
Looks good but donβt forget to include all the options
Agreed for options like algorithm, dropdowns are better
But not for numbers with ranges
Like blur amount
can u join #916825646251012106
would be good for fps and dedup
Nah
is this good?
Fps should be a slider with a text box, maybe with snapping to multiples of common fps but idk
yes algo should def be a dropdown
Donβt forget to include all 6 interpolation algorithms (1, 2, 11, 13, 21, 23)
And add some of those β icons next to options that can explain to you what they do
Not needed but itβs nice to have
how many unfinished smoothie guis are there π
how are we gonna do weighting
i don't think anyone knows how they actually work atm
maybe there could be a custom toggle in the gui editor
a drop down of all options
ye documentation
oh god
i mean for the functions themselves yeah
but what about params
i guess u could just have an arbitrary number of key + value fields
like
if selected function can take extra params
add key and value text boxes and a + button next to them to create another key/value box pair
nvm i think i get it
isn't sm's config modular
Dw
it just calls parse_weights2() with the raw config setting
which returns the weight array
slightly scuffed but its not much to fix
@flint scarab can i make weighting.py a submodule or something
if u bother maintaining it in smoothie-rs sure
it's not much to maintain u just have to sync it every once in a while
or i can whenever i commit
easier to sync than copying the whole file over from my repo
especially if i decide to make weighting split into multiple files
internal windows 
can be collapsed
though this is kind of a scuffed way to do it 
im sure theres better ways to collapse stuff
Mf got the Minecraft client GUI

some minecraft hacks prob make use of egui lol
thereβs def been csgo (and even mc)!hacks using imgui
nah thats the qm website ui
spot the difference!
LOL
@flint scarab π SMOOTHIE WEBSITE π―
nah I got the arrow key gui on the site
Couleur has the actual gui
The qm docs are so out of date smh
And I need go docs and a scoop version
But the go version is kinda done
Nothing else to really add or change
check the docusaurus folder in ctt/smoothie
u can do a cool front page if u want
no i hate frontend
Ass π₯
bri
Bad website π₯
who asked
@topaz blaze ```py
def write_csv(filename: str, sections: list[str], data: list[list[float]]) -> None:
with open(filename, "w") as f:
f.write(",".join(sections) + "\n")
for line in data:
assert len(line) == len(sections)
f.write(",".join(map(str, line)) + "\n")
wdym by excel layout?
this is how csv files look
thats the standard
it wont be csv if you change it
u could make this a lot faster pretty easily by making it write in chunks
if thats a concern
a graph?
excel has an option for saving the spreadsheet as csv
if thats what youre looking for
interesting
gl
prolly not im busy
i have that in like
a month
why not use the csv module
thats a thing?
yes
;compile ```py
print(help(import("csv")))
Help on module csv:
NAME
csv - CSV parsing and writing.
MODULE REFERENCE
https://docs.python.org/3.11/library/csv.html
The following documentation is automatically generated from the Python
source files. It may be incomplete,
what are you trying to do?
frick you compiler
efps 
why do u need ai for estimating performance
efps is bullshit
Just run some quick test
literally just benchmark it
things like this exist
yeah
presentmon 
^ like atzur said
open game
measure fps/frametimes/whatever
use results for tuning config
i have done it multiple times
dead easy with presetmon
i feel that's practically impossible lmao
i mean we got people here that have underperforming systems

i have seen plenty of people here having high end pcs but perform badly
i am just baffled
data of what
benchmarks and stuff
^
same hw != same perf
he wants to make this https://www.userbenchmark.com/Faq/What-are-effective-frames-per-second-EFps/112
i mean my mom's laptop actually runs mc better than a shitass gaming laptop if the temp limit is removed
Using ai seems like a poor way to do this
You could find the correlations pretty easily
honestly the idea is kind of pointless
e-fps doesn't showcase what actual performance, you will get for your hardware
so many other factors involved
Send me all the data
..
new gui
made today
tell me things to improve
this is like how couleur told me to do it
gui for non graphic stuff is terrible
ok this is ugly layout wise
ew
Something u can never make
I know it's not good
I was trying something out
i would never make that fucking shit
Ahm Ahm
Ahn
howd u do it
Donβt make it so wide
ima be honest iβd rather use the yaml file than that itβs too messy
ima be honest iβd rather use the cli than the yaml file
the best configs files are scripts you write with the cli command
luminance pov
sm -i video --interp speed=medium:fps=960 --blend fps=60:intensity=1.5 -o out
no oneβs typing allat
True
PyQt5 Library but it's bad gotta make it look better'
Honestly just use a for loop with a list of options for things like algorithm and speed and just make a box for each
oh finally my eyes
thank you lord atzur

lol
what?
stupi
its maximized
and thats why i sent it here for the reviews
tell me what to add what to remove and stuff
@untold narwhal
what
and for each section add keys
so if a new section gets added it also gets added to the gui?
what
make it look nicer
can u click on weighting
where's the other options
π
custom weighting as well
equal gaussian gaussian_sym pyramid ascending vegas custom
i have never used this
i think that's all?
thats all?
lemme check
these and descending
that's all
really doing it all manually
wot
read yaml > get all sections > make a group and layout for the section > add every value in the section as a button under the group made > make lists for things like weighting and algorithms and only be able to choose from those
custom gaussian and gaussian_sym have extra settings btw
is this for py or rs?
when hes free
no point in making one for py
yea
oh you're missing bright blend btw
and that
area doesn't exist in smrs anymore though right
it does
coler said it was useless
oki
nvm it does exist it's just hidden
can u make this not big widie
Oki
Tell me all the changes I should make
somewhat
added bright blend
oki doing
what is blend ratio, intensity?
this would be cool
instead of hardcoding the gui and manually adding options, have some metadata (in defaults.ini only) that programmatically loads options
what option does that correspond do
Am noob
Intensity
missing a lot but ya
May I do it like this?
When I made tabs u guys said u don't want tabs
;_;
i want tabs
doesn't this just look cleaner and usable?
obs is a whole ass application, this is a glorified text editor
big difference
Hm
So I make the tab alignment like last time or like obs
GUI for this is pretty useless
^
A GUI just to edit the config isnβt needed, thatβs what notepad is for
If you added rendering, multiqueue, file selection, etc, itβd be different
not needed but it would be pretty nice
you can make it self documenting
smoothie configs are complex enough that even if proper docs for it existed, they'd probably be less intuitive than a good ui
Fucking give the idea then I will add
# literally brain-fucking semi-boilerplate, it's the exact same problem but with little variations
a comment couleur wrote, somewhere
semi-boilerplate ??
i'm porting something, and it has multiple ways to do the same thing, and since i gotta support them all i need to write the same code multiple times but with different variables
skill issue from who i'm porting from*
just refactor it
it's 6000 lines 
^
Master html and css
Javascript
I know I'm pro

Student in IT development
your website and this guy looks similar https://ahmosys.is-a.dev/
π
He's my friend
yes
It's his portfolio
but why copy a lot of it
Thatβs not just a lot, thatβs practically a whole copy paste
when the project is open source:
Copy a lot?
It's same as him
I also did some part of it though
70% work was done by him though
This was made by me
On god
could u educate me on what it means to be a "frontend game developer"
LMFAOO
nah bruh bro manages the website for the games π
I made like 10-20 games using javascript 2d
Javascript.
what does that have to do with frontend
Thatβd be βbackendβ in this odd and unusual context
I doubt itβs an actual term but Iβd assume itβd be developing the interfaces and textures (like opening a chest in mc) but none of the deeper mechanics (like entity collisions)
Yeah fs
no u
I'm a front-end sql dev
im a back end tomato dev
GUI so useless
You are more useless
^^^ ||(jk)||
its bad ig
wot
it's medium fast faster fastest
honestly i would rather have a comment in the config file that gives a description of what the setting does
function Get-NvidiaGpuProperties {
$NvidiaGpuProperties = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\????" -ErrorAction SilentlyContinue |
Where-Object { $_.MatchingDeviceId.StartsWith("pci\ven_10de") }
return [ordered]@{
"Key" = $NvidiaGpuProperties.PSPath.TrimStart("Microsoft.PowerShell.Core\Registry::")
"Dynamic P-State" = !$NvidiaGpuProperties.DisableDynamicPstate
"HDCP" = !$NvidiaGpuProperties.RMHdcpKeyglobZero
"NVIDIA Control Panel Telemetry" = [bool](Get-ItemProperty "HKLM:\SOFTWARE\NVIDIA Corporation\NvControlPanel2\Client" -ErrorAction SilentlyContinue).OptInOrOutPreference
"NVIDIA Service Telemetry" = [bool](Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\nvlddmkm\Global\Startup" -ErrorAction SilentlyContinue).SendTelemetryData
};
}
function Set-NvidiaGpuProperty (
[Parameter(Mandatory = $True)][string]$Property,
[Parameter(Mandatory = $True)][bool]$State) {
$Key = (Get-NvidiaGpuProperties).Key
$Value = (![int]$State)
switch ($Property.Trim()) {
"DynamicPState" {New-ItemProperty "Registry::$Key" "DisableDynamicPstate" -Value $Value -PropertyType DWORD -Force}
"HDCP" {New-ItemProperty "Registry::$Key" "RMHdcpKeyglobZero" -Value $Value -PropertyType DWORD -Force}
"NVCPLTelemetry" {New-ItemProperty "HKLM:\SOFTWARE\NVIDIA Corporation\NvControlPanel2\Client" "OptInOrOutPreference" -Value (!$Value) -PropertyType DWORD -Force}
"NVSTelemetry" {New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\nvlddmkm\Global\Startup" "SendTelemetryData" -Value (!$Value) -PropertyType DWORD -Force}
default {Write-Error "Invalid Property."}
}
}
You can apply some NVIDIA GPU specific tweaks using these commands.

I am gonna MSI Mode at some point in the future.
import requests
from bs4 import BeautifulSoup
import argparse
import webbrowser
import os
import random
# Use the argparse library to parse command line arguments.
parser = argparse.ArgumentParser(description='Generate links for random maths past papers from the BestExamHelp website.')
parser.add_argument('-d', '--download', action='store_true', help='Download a random past paper.')
parser.add_argument('-b', '--browser', action='store_true', help='Open a random past paper in the browser.')
args = parser.parse_args()
# Scrape all the past paper links from the BestExamHelp website.
def scrape_links():
url = 'https://bestexamhelp.com/cie-cambridge-international-education/igcse/mathematics-0580'
data = requests.get(url)
links = parse_data(data.text)
return [link.get('href') for link in links]
# Download a random past paper from the BestExamHelp website.
def download_random_paper():
links = scrape_links()
random_link = random.choice(links)
file_name = random_link.split('/')[-1]
response = requests.get(random_link)
with open(file_name, 'wb') as f:
f.write(response.content)
print(f'Downloaded {file_name} from {random_link}')
# Open a random past paper in the browser.
def open_random_paper():
links = scrape_links()
if not links:
print("No links found for mathematics past papers on BestExamHelp website.")
return
random_link = random.choice(links)
if download_paper:
download_paper_from_link(random_link)
else:
open_link_in_browser(random_link)
# Parse the command line arguments and execute the appropriate action.
if args.download:
download_random_paper()
elif args.browser:
open_random_paper()
else:
print('No action specified. Use -d/--download to download a random past paper, or -b/--browser to open a random past paper in the browser.')
i have 0 idea what im doing
im fucking lost please help
;compile
Traceback (most recent call last):
File "/app/output.s", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
@molten barn π₯Ί fix my shit ass code π π 
i put comments so people could see the intention
cause the bot doesnt have requests
from bs4 import BeautifulSoup
import argparse
import webbrowser
import os
import random
# Use the argparse library to parse command line arguments.
parser = argparse.ArgumentParser(description='Generate links for random maths past papers from the BestExamHelp website.')
parser.add_argument('-d', '--download', action='store_true', help='Download a random past paper.')
parser.add_argument('-b', '--browser', action='store_true', help='Open a random past paper in the browser.')
args = parser.parse_args()
# Scrape all the past paper links from the BestExamHelp website.
def scrape_links():
url = 'https://bestexamhelp.com/cie-cambridge-international-education/igcse/mathematics-0580'
data = requests.get(url)
links = parse_data(data.text)
return [link.get('href') for link in links]
def parse_data(data):
soup = BeautifulSoup(data, 'html.parser')
return soup.find_all('a', {'class': 'mathematics-0580'})
# Download a random past paper from the BestExamHelp website.
def download_random_paper():
links = scrape_links()
random_link = random.choice(links)
file_name = random_link.split('/')[-1]
response = requests.get(random_link)
with open(file_name, 'wb') as f:
f.write(response.content)
print(f'Downloaded {file_name} from {random_link}')
# Open a random past paper in the browser.
def open_random_paper():
links = scrape_links()
if not links:
print("No links found for mathematics past papers on BestExamHelp website.")
return
random_link = random.choice(links)
open_link_in_browser(random_link)
def open_link_in_browser(link):
webbrowser.open(link)
# Parse the command line arguments and execute the appropriate action.
if args.download:
download_random_paper()
elif args.browser:
open_random_paper()
else:
print('No action specified. Use -d/--download to download a random past paper, or -b/--browser to open a random past paper in the browser.')```
;compile
;compile py
Traceback (most recent call last):
File "/app/output.s", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // width of ellipse
int nHeightEllipse // height of ellipse
);
in form1_load:
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
Lol
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class CustomForm : Form
{
// Declare the external function from Gdi32.dll
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // width of ellipse
int nHeightEllipse // height of ellipse
);
// Public properties for customizable rounding parameters
public int RoundingWidth { get; set; } = 20;
public int RoundingHeight { get; set; } = 20;
// Constructor
public CustomForm()
{
// Set the form's background color and border style
BackColor = Color.White;
FormBorderStyle = FormBorderStyle.None;
}
// Override the OnPaint method to add anti-aliasing
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
base.OnPaint(e);
}
// Override the OnResize method to update the region when the form is resized
protected override void OnResize(EventArgs e)
{
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, RoundingWidth, RoundingHeight));
base.OnResize(e);
}
// Override the WndProc method to allow dragging the form from anywhere inside it
protected override void WndProc(ref Message m)
{
const int WM_NCHITTEST = 0x0084;
const int HTCLIENT = 0x01;
const int HTCAPTION = 0x02;
if (m.Msg == WM_NCHITTEST && (int)m.Result == HTCLIENT)
{
m.Result = (IntPtr)HTCAPTION;
return;
}
base.WndProc(ref m);
}
// Override the OnMouseDown method to allow dragging the form from anywhere inside it
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
base.OnMouseDown(e);
}
// Declare the ReleaseCapture and SendMessage functions from user32.dll
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
// Entry point
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CustomForm form = new CustomForm();
// Set the form's size and position
form.Size = new Size(600, 400);
form.StartPosition = FormStartPosition.CenterScreen;
// Set the form's background color and border style
form.BackColor = Color.White;
form.FormBorderStyle = FormBorderStyle.None;
// Set the form's rounding parameters
form.RoundingWidth = 50;
form.RoundingHeight = 50;
// Show the form
Application.Run(form);
}
}```
I have customized your code as how you wanted
;compile
;compile c#
ok
```prog.cs(2,14): error CS0234: The type or namespace name βDrawing' does not exist in the namespace βSystem'. Are you missing βSystem.Drawing' assembly reference? prog.cs(4,22): error CS0234: The type or namespace name βForms' does not exist in the namespace βSystem.Windows'. Are you missing βSystem.Windows.Forms' assembly reference?
prog.cs(6,27): error CS0246: The type or namespace name βForm' could not be found. Are you missing an assembly reference? prog.cs(33,37): error CS0246: The type or namespace name βPaintEventArgs' could not be found. Are you missing an assembly reference?
prog.cs(40,29): error CS0115: βCustomForm.OnResize(System.EventArgs)' is marked as an override but no suitable method found to override prog.cs(47,41): error CS0246: The type or namespace name βMessage' could not be found. Are you missing an assembly reference?
prog.cs(63,41): error CS0246: The type or namespace name β`MouseEventArgs' could not be found. Are you missing an assembly reference?
Co
Try running now
?
both error cs0103
Send me the full error here
An dumb
WM_NCLBUTTONDOWN
Rename it with this
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
base.OnMouseDown(e);
}
// Declare the ReleaseCapture and SendMessage functions from user32.dll
[DllImport("user32.dll")]
private static extern bool ReleaseCapture();
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);```
thats the exact same code
doesnt do anything






