#💻︱programming

1 messages · Page 3 of 1

quiet arrow
#

What's your python version sus

quiet arrow
#

You should definitely be able to use f strings, very weird

spring tiger
#

make sure vscode is using the newer version (look bottom right on the blue bar)
When you install new versions it doesn't remove old versions

quiet arrow
#

Bit iffy, but it works 🙂

import random

from typing import (
    TypedDict,
    List
)

class gameData(TypedDict):
    USER_POINTS: int
    COMPUTER_POINTS: int
    POINTS_TO_WIN: int
    OPTIONS: List[str]


def player_turn(game: gameData):
    player_choice = input(f"Choose: {', '.join(game['OPTIONS'])} [Type Q to Quit].\n=>> ")
    
    if player_choice.lower() == "q":
        return
    elif player_choice.lower() in game["OPTIONS"]:
        results(game, player_choice.lower())
    else:
        player_turn(game)


def results(game: gameData, player_choice: str):
    computer_choice = random.choice(game["OPTIONS"])

    if (game["OPTIONS"][(game["OPTIONS"].index(player_choice) + 1) % len(game["OPTIONS"])]) == computer_choice:
        # Computer choice is next one in list and wins
        game["COMPUTER_POINTS"] += 1
        print(f"\nThe computer choose {computer_choice}. And wins!" + score_formatter(game))
    elif player_choice == computer_choice:
        # Draw
        game["COMPUTER_POINTS"] += .5
        game["USER_POINTS"] += .5
        print(f"\nThe computer choose {computer_choice}. And draws!" + score_formatter(game))
    else:
        # Player wins
        game["USER_POINTS"] += 1
        print(f"\nThe computer choose {computer_choice}. And loses!" + score_formatter(game))

    continue_game(game)

def continue_game(game: gameData):
    if game["COMPUTER_POINTS"] == game["USER_POINTS"]:
        player_turn(game)
    elif game["USER_POINTS"] >= game["POINTS_TO_WIN"]:
        print("[SYSTEM] YOU win with results:" + score_formatter(game))
    elif game["COMPUTER_POINTS"] >= game["POINTS_TO_WIN"]:
        print("[SYSTEM] The computer wins with results:" + score_formatter(game))
    else:
        player_turn(game)


def score_formatter(game: gameData):
    return f"\nScores:\n\tCOMPUTER: {game['COMPUTER_POINTS']}\n\tYOU: {game['USER_POINTS']}\n"

def main():
    game: gameData = {
        "USER_POINTS": 0,
        "COMPUTER_POINTS": 0,
        "POINTS_TO_WIN": 20,
        "OPTIONS": ["rock", "paper", "scissors"]
    }
    player_turn(game)

if __name__ == "__main__":
    main()
indigo nacelle
#
print(“You won!”)

It handles all the input for you! Also no need for random module, as I have randomly chosen the result with my mind

hard roost
#

Cursed code

import random
print("Q to quit")
def game(player, computer):
    if input("Rock, paper or scissors: ").lower() == "q":
        print(f'{"Player won!" if computer < player else "Draw!" if player == computer else "Computer won!"}')
        return
    result = random.choice(["Draw!", "You lost!", "You won!"])
    if result == "Draw!":
        computer += 0.5
        player += 0.5
    elif result == "You lost!":
        computer += 1
    elif result == "You won!":
        player += 1
    print(f"{result}\nComputer: {computer}\nPlayer: {player}")
    game(player,computer)
game(0,0)
#

It works tho

open needle
brisk badge
open needle
brisk badge
#

python is just a little easier to read

open needle
#

In my school

quiet arrow
#

My school teaches scheme 😭

open needle
quiet arrow
#

It's from 1960 and looks like vomit

open needle
#

Ok now I see😂

quiet arrow
#

:p

brisk badge
brisk badge
open needle
# brisk badge That helps a ton

I'm hoping to become moderator on cubecraft, also wanna be a developer but I don't think I can learn python, I really love cubecraft

brisk badge
open needle
#

I guess so, I'll try:)

brisk badge
#

I would just practise with making plugins mainly

open needle
#

Will put it in consideration

peak pewter
#

I want it to

#

but don't know how to start

brisk badge
#

Watch some tutorial on YouTube, dive into the used language

jovial heron
jovial heron
#

i've found out this

list = ["a", "b", "c"]

# better
for i, x in enumerate(list):
    if i == 0:
        print(x, "example")
    else:
        print(x)
      
# common
for i in range(len(list)):
    if list[i] == "a":
        print('\n' + list[i], "example")
    else:
        print(list[i])
spring tiger
#

enumerate is great

jovial heron
#

yp :D

minor roost
#

Anyone know how to fix Xbox one S fps drop

#

I currently run Minecraft at ab 30-40 fps does anyone know how to increase it? All my settings are low my texture pack is very lite

minor roost
#

can't do anything about it

minor roost
#

@minor roost do yk what rizz is?

plush walrus
#

are string literals faster over <String>.format() in python?

minor roost
#

no

quiet arrow
#

.

#

Not why you’d compare with literals as they do something else. I think?

minor roost
#

dont buy pre built PC's, they are generally poorly built and over prized

#

well theres a lot of repeating

#

try making a function to group similar code

#

and .format is cursed dont use it

#

yes replying after days is pointless i just realised everything i just said was already said

brisk badge
#

It is fun to build one though

minor roost
minor roost
minor roost
#

unless u wanna keep track of index, but really why 99% of time

#

Does anyone has expierience with publishing on google play store?

minor roost
open needle
minor roost
#

Well better sooner than later they say

minor roost
#

Bro came in and was mencing

brisk badge
jovial heron
true mantle
#

He showed a 300 euro case from bol.com😭

fallow canyon
quiet arrow
fallow canyon
fallow yacht
fallow canyon
#

Nah but in all seriousness, just keep checking back, that's what I did when I applied, eventually there will be something.

quiet arrow
fallow canyon
#

You see how mean he is, def not worth it.

#

My sanity has deteriorated since I started getting trolled by that guy

quiet arrow
#

My condolences

fallow canyon
#

Thank you 😦

sharp crystal
open needle
open needle
#

🤣🤣🤣🤣🤣broooooooo

brisk badge
open needle
#

I thought they are all REALLY different

brisk badge
#

Language are often like each other actually

open needle
#

Really*

open needle
brisk badge
#

And if know how to think like a programmer is syntax memorization not a problem

open needle
#

Because I also have physics and chemistry

brisk badge
brisk badge
#

;)

quiet arrow
#

cries

open needle
brisk badge
open needle
brisk badge
#

Hahaha relatable

open needle
#

Atleast I know where to start once I have my pc back:)

wheat relic
#

Anyone know how to remove the downwards KB after fall damage? Or any damage in general in Java 1.19? Waterfall/Paper/Spigot?

wicked flint
#

anyone wanna help me code a stupid game for fun with java

#

itz rely sussy 🥶 🥶 🥶

open needle
#

@brisk badge you got me thinking of my life choices, should I be a mechanical engineer or a computer programmer

brisk badge
#

Computer science can be a bit more theoretical than mechanical engineering, so you need to ask yourself what fits you

open needle
#

I do know that, I know a lot more about computers than mechanical engineering, and programming/computer science is something I can do at home

minor roost
#

the what

brisk badge
#

It might be a good idea to ask your question in English

jovial heron
#
import random 

MAX_LINES = 3
MIN_BET = 1
MAX_BET = 100

ROWS = 3
COLS = 3

symbols_count = {
    'A': 3,
    'B': 3,
    'C': 3,
    'D': 3
}

symbols_value = {
    'A': 4,
    'B': 3,
    'C': 2,
    'D': 1
}

def slot_machines_winnings(columns, lines, bet, values):
    winning_lines = []
    winnings = 0
    for line in range(lines):
        symbol = columns[0][line]
        for column in columns:
            symbol_to_check = column[line]
            if symbol != symbol_to_check:
                break
        else:
            winnings += values[symbol] *bet
            winning_lines.append(line + 1)
    return winnings, winning_lines

def machine_spinning(rows, cols, symbols):
    all_symbols = []
    for symbol, symbol_count in symbols_count.items():
        for _ in range(symbol_count):
            all_symbols.append(symbol)
    
    columns = []
    for _ in range(cols):
        column = []
        current_symbols = all_symbols[:]
        for _ in range(rows):
            value = random.choice(current_symbols)
            current_symbols.remove(value)
            column.append(value)
        
        columns.append(column)
    
    return columns

                    
def print_slot_machine(columns):
    for row in range(len(columns[0])):
        for i, column in enumerate(columns):
            if i != len(columns) - 1:    
                print(column[row], end=' | ')
            else:
                print(column[row], end='')
        print()

def get_deposit():
    while True:
        deposit_amount = input('\n'*10 + "Enter the deposit $ ")
        if deposit_amount.isdigit():
            deposit_amount = int(deposit_amount)
            if deposit_amount < 0:
                print("Please enter a number that is greater than 0.")
            else:
                break
        else:
            print("Please enter a number.")
    
    return deposit_amount
            

def get_number_of_lines():
    while True:
        lines = input("Enter the number of lines to bet on (1-" + str(MAX_LINES)
                      + ")? ")
        if lines.isdigit():
            lines = int(lines)
            if 1 <= lines <= MAX_LINES:
                break
            else:
                print("Enter a valid number of lines.")
        else:
            print("Please enter a number.")
    
    return lines


def get_bet():
    while True:
        bet_amount = input("How much do you want to bet on (in each line)? $")
        if bet_amount.isdigit():
            bet_amount = int(bet_amount)
            if MIN_BET <= bet_amount <= MAX_BET:
                break
            else:
                print(f"Please enter a bet that is between $({MIN_BET} - {MAX_BET}).")
    return bet_amount

def spin(deposit):
    lines = get_number_of_lines()
    while True:
        bet = get_bet()
        total_bet = bet * lines
        if total_bet > deposit:
            print(f"You can't bet on a number greater than your balance, which is ${deposit}")
        else:
            break
    print(f"You are betting ${bet} on {lines} lines. Total bet is: ${total_bet}.")
      
      
    slots = machine_spinning(ROWS, COLS, symbols_count) 
    print_slot_machine(slots)
    winnings, winning_lines = slot_machines_winnings(slots, lines, bet, symbols_value)
    print(f'You won ${winnings}, on', *winning_lines, 'lines.')
    return  winnings - total_bet


def main():
    deposit = get_deposit()
    while True:
        print(f'Your current balance is ${deposit}')
        spinz = input('Type anything to spin (Q to quit).')
        if spinz.lower() == 'q':
            break
        else:
            deposit += spin(deposit)
    
    print(f'You left with a ${deposit} balance.')
main()

i got confused

minor roost
#

Hmmm?

carmine vine
#

@ashen bramble

jovial heron
#

W comprehensive dictionaries

sonic galleon
quiet arrow
#

You have to make sure what you write is still readable, you might know now what it does. But if you look back at it later, you'll have no idea what this is supposed to do. (List) comprehension is really amazing, but it should still be clear and readable

low ermine
#

tbh that one is surprisingly readable as far as lengthy comprehensions go

indigo nacelle
#

yall just slow typers fr 🥱

indigo nacelle
#

Just realized you literally can’t see anything

brisk badge
jovial heron
#

i made this as well

brisk badge
jovial heron
#

it's easy to read tbh

brisk badge
#

In that case it is okay!

cinder mason
minor roost
#

#CommentsAreForTheWeak

minor roost
#

made my first android app

#

to be exact its a part of a bigger project made to control school's music during breaks via ur phone

#

its made from backend server written in django (deployed on my rpi already), a python player program (yet to be deployed on school's rpi) and ofc the android app written in java

#

Communicating with the server is both over normal https and websockets, and (hopefully) its all "troll" proof as everyone has their own account with diffrent permmisions. Logging in on android app is made with JWT

#

idk why im saying this but im just really happy it all works now

#

Tbf the only reason i did this was to rickroll my entire school 😂

minor roost
#

lol

jovial heron
#

i use the vibrant version

jovial heron
minor roost
vital summit
#

What is wrong double chest has to be dark red as normal chest

#

Theresnt code in terrain_texture.json file for double chests

minor roost
#

Can anyone program me a server i will pay him

warm galleon
minor roost
#

hard to help you when u provide so little info to work with

#

I can try guessing that u are making a texture pack, u managed to change texture of single chest but are strugling with changing how double chest look?

#

also ig its bedrock

vital summit
#

Ofc

vital summit
minor roost
#

so we can try to help

vital summit
#

I explained everything

#

...

minor roost
#

i beg to differ

hard roost
#

He wants the double chest to have the same red texture as the single chest

vital summit
#

yes

#

help on it too pls

#

How to make this line more visible

#

its too small

brisk badge
#

Cant you just edit the texture?

minor roost
#

yea from what i remember(at least on java) there are 3 textures that controll chests, that is:
single chest texture
left chest texture
right chest texture

#

@vital summit

minor roost
vital summit
minor roost
true mantle
minor roost
#

here u can find all names

#

(hopefully)

#

i have to say its easier to make txt for java, tho bedrock has much more potential

vital summit
#

bro i already have it

#

ahhhhhhhhhhhhh

brisk badge
#

Did you try to google your problem?

true mantle
#

I don't know if this fits into programming but I bought a Webhosting and got acces to an admin panel "DirectAdmin" now my question is if you want to work with a database how does that work?

minor roost
#

idk

vital summit
#

Ig nothing can help me

#

cuz its minecraft bug may be

brisk badge
minor roost
#

how do i recolor packs

vital summit
#

DM for link

minor roost
#

okay

#

u gotta add me so i can dm u

jovial heron
#
import cv2 as cv
import numpy as np 
import random

width = 1000
height = 600
num_of_trees = 30
ground_level = height-100

whitish_yellow, yellow = (153,255,255), (0,255,255)

bg = np.zeros((height,width,3),dtype=np.uint8)

cv.rectangle(bg, (0,0), (width, ground_level), (255,153,51), -1)
cv.rectangle(bg, (0,ground_level), (width,height), (0, 204, 0), -1)

class Tree():
    def __init__(self, image):
        self.img = image
        self.loc = int(np.random.choice(range(1000), 1))
        self.ht = int(np.random.choice(range(200,400), 1))
        self.radious = 50
        self.scale = np.random.choice(np.linspace(1, 2.5, num=8), 1)
        
    def generate_colors(self):
        green = (0,random.randint(130, 200),0)
        dark_green = (35,random.randint(220, 253),35)
        brown = random.choice([(2,30,85), (5,55,120), (0,70,140)])
        
        return green, dark_green, brown
    
    def draw(self):
        s_radious = int(self.radious*self.scale-20*self.scale)
        green, dark_green, brown = self.generate_colors()     
        
           
        cv.circle(self.img,(self.loc, ground_level-self.ht), int(self.radious*self.scale), green, -1)
        cv.circle(self.img,(self.loc-int(45*self.scale), ground_level-self.ht+s_radious), s_radious, green, -1) 
        cv.circle(self.img,(self.loc+int(45*self.scale), ground_level-self.ht+s_radious), s_radious, green, -1) 
        
        cv.line(self.img, (self.loc, ground_level), (self.loc, ground_level-self.ht), brown, int(15*self.scale))
        cv.line(self.img, (self.loc, ground_level-self.ht+int(75*self.scale)), (self.loc+int(45*self.scale), ground_level-self.ht+s_radious), brown, int(5*self.scale))
        cv.line(self.img, (self.loc, ground_level-self.ht+int(75*self.scale)), (self.loc-int(45*self.scale), ground_level-self.ht+s_radious), brown, int(5*self.scale))
        
        cv.circle(self.img,(self.loc, ground_level-self.ht), int(self.radious*self.scale-10*self.scale), dark_green, -1)
        cv.circle(self.img,(self.loc-int(45*self.scale), ground_level-self.ht+s_radious), int(s_radious-8*self.scale), dark_green, -1) 
        cv.circle(self.img,(self.loc+int(45*self.scale), ground_level-self.ht+s_radious), int(s_radious-8*self.scale), dark_green, -1) 

        cv.rectangle(bg, (0,ground_level), (width,height), (0, 204, 0), -1)
        
        return self.img

for tree in range(num_of_trees):
    img = Tree(bg).draw()

cv.imshow('OOP with OpenCV and NumPY', img)
cv.waitKey(0)
cv.destroyAllWindows()
#

it generates random trees every time you launch the code

jovial wind
#

niiice

minor roost
jovial wind
#

ew, I heard it's a horrible language to learn/code in

#

bcs it's so strict

#

but also gives you a ton of possibilities?

plush walrus
obsidian linden
#

Python is not strict, it's the complete opposite. It makes a lot of the data type stuff by itself which is really nice, but can cause weird issues. Also when learning Python first, it's hard to get into more complex programming languages like C, C++ or Java.

jovial wind
#

ohh

plush walrus
#

but I'd say python is a good start and it's not that hard imo to move to js/ts/java from my experience

jovial heron
tiny plank
jovial wind
#

Thx

jovial heron
minor roost
#

idk ig i would be to lazy to spend my time to create a program that makes trees

#

xD

candid jay
#

could make a cool roguelike plaformer with that

charred meadow
wheat relic
#

Anyone able to fix Downwards KB on java Spigot/Waterfall? I will pay $200 istg I want to remove it from survival

#

plspls

jovial heron
minor roost
#

Does every website(that uses cookies) need that stupid cookie info popup? Even if It's made by not a business?

#

Asking RODO (of whatever other law) wise

sharp crystal
#

It's required by the European law

plush walrus
#

but only if you use those cookies for advertising or tracking I think

jovial heron
#

is cubecraft programmed in php?

warm galleon
jovial heron
#

Programming lang

minor roost
jovial heron
spring tiger
#

No it is not programmed in php

wheat relic
jovial heron
jovial heron
#

what is spigot

wheat relic
#

eggwars was programmed in bukkit/spigot

#

Java server program

#

for minecraft

#

uses java

#

Then Bedrock converts the Java server into bedrock with some form of geyser

#

cubecraft denies it but it's pretty obvious it's a java server as downwards KB exists

minor roost
#

they deny it???

#

thought it was always known that it's based on java

wheat relic
#

me: so why is there downwards KB?

#

"because It's from Java"

#

me: Okay so you use java/geyser?

#

"No it's a bedrock server"

#

me: but you said that downwards KB was for java?

#

then they repeat

plush walrus
#

bedrock player crying about knockback occurrence #748291

dense zinc
wheat relic
dense zinc
jovial heron
wheat relic
wheat relic
#

they said they fixed it cause it doesn't happen in java

#

when it does for both those things lol

silk swift
#

Hi dark

plush walrus
wheat relic
minor roost
#

how are messages for server's main page chosen?

minor roost
minor roost
zenith gate
#

Hi I'm back

plush lotus
#

i should not be chatting here cuz i bad

brisk badge
tribal summit
#

It's programming... We all bad and we all still learning 😛

dim mason
#

i use linux i win all coding and programming

#

(i am bad i want windows)

tribal summit
#

Ah yes, Linux

#

The age old question of how to exit VIM

quiet arrow
#

I really don't understand that joke tbh

plush walrus
candid jay
#

how declare variable in html

#

pls help

plush walrus
#

I've remember the first time I accidentally opened vim

tribal summit
#

People not knowing how to close the VI (and later VIM) code editor

tribal summit
quiet arrow
tribal summit
#

Also okay, maybe not a joke, but I heard it quite a few times in my college years already xD Maybe we can call it an anecdote

wooden aspen
#

does anyone know how to disable glow effects on java

#

they lag my game a lot

#

and ive been looking everywhere like reddit and other forums about the issue but just cant manage to find a fix for it

minor roost
#

or get a resource pack

#

for (EntityPlayer player : Minecraft.getMinecraft().world.playerEntities) {
player.setGlow(false);
}
add that to onTick method and it may work?

wooden aspen
#

thx :)

wooden aspen
#

idrk what im doing 💀

quiet arrow
#

Doesn’t Optifine have a setting for that?

candid storm
candid storm
candid storm
# wooden aspen thank u

No problem, might or might not work 🤷‍♂️
Start an issue on the github page if you see it not working or have problems

wooden aspen
#

alright imma try it and see if it works

candid storm
wooden aspen
hard roost
#

You can open it in your favourite zip extractor and modify the fabric.mod.json minecraft version to 1.19.2

wooden aspen
#

may u perhaps tell me how

hard roost
#

do you have winrar or 7zip?

hard roost
wooden aspen
candid storm
#

sure I'll make it work on 1.19.2

hard roost
wooden aspen
wooden aspen
#

how

#

what numeral do i change and how do i do it

hard roost
#

rename the jar to zip and Extract all by right clicking

candid storm
#

I don't mind

wooden aspen
hard roost
#

ok do you have a normal folder

wooden aspen
#

yes i indeed do

hard roost
#

open it if you havent and do you see a fabric.mod.json

wooden aspen
#

yes

#

i have too many things opened

#

my screen

hard roost
#

good, open it in notepad

wooden aspen
#

is a mess

wooden aspen
hard roost
#

you should see "minecraft": "~1.19.3"

wooden aspen
#

ok thank u

#

:)))

hard roost
#

👍 change 3 to 2 or you can just remove the .3

candid storm
#

I love the advice, but that will still crash

hard roost
#

how

candid storm
#

Depends on latest fabricloader

#

you should see

    "depends": {
        "fabricloader": ">=0.14.13",
        "minecraft": "~1.19.3",
        "java": ">=17",
        "fabric-api": "*"
    }

Replace that with

    "depends": {
        "fabricloader": ">=0.14.12",
        "minecraft": "~1.19.2",
        "java": ">=17",
        "fabric-api": "*"
    }
hard roost
#

oh yeah

#

mans got muted

#

you should not restrict it to 1.19.2 since it most likely (99%) works from since glowing was added

hard roost
wooden aspen
#

.14.12

#

13*

hard roost
#

oh yeah x2 since loader can be on all versions?

#

fabric api is what is version dependant

candid storm
#

Because it has the >= it should work on higher versions too

#

That's just what the fabric template mod shipped with, so with those changes it should work (I tested, and it worked fine)

#

I can't share the pre-compiled version here unfortunately as a .jar file could be a virus I guess so the system flags them.

So download the source code from github (and make sure the code is safe (am I a good boy now mods?)), do the changes I highlighted and run ./gradlew build

hard roost
#

just upload the jar to your github

candid storm
wooden aspen
#

I'm testing the mod rn

#

see if it works for me

candid storm
wooden aspen
#

IT WORKS WOOHOO

hard roost
#

Just change the fabric.mod.json and gh actions will build it and link it with nightly.link

wooden aspen
#

THANK U GUYS

hard roost
#

👍

candid storm
hard roost
#

Not really different than linking a Github releases page

serene remnant
#

yo wassup guys

#

im tryna look for fwiends 😭

#

lol

tribal summit
#

Hello there 👋

#

Are you a fellow programmer as well?

indigo nacelle
#

Chatbot has infinite iq

minor roost
#

XD

#

Does anyone know how byte audio streams work?

#

Encodijg decoding, understanding chunks byterate(yes I'm throwing random words)

#

I would really use a good articule if u know one

minor roost
#

Anyone knows how to port a Java texture pack to a bedrock one (including the textures of the ui)?

spring tiger
#

manually, especially with the UI. bedrock UI system is completely different to the java one

minor roost
#

I used a phone app and it worked but not for the ui sadly

vital saddle
#

what programming language is ideal for designing games?

#

i heard C++ is one of the best

plush walrus
plush walrus
brisk badge
#

And unity uses c#

plush walrus
#

c++ is generally faster and allows more low-level scope than c#

vital saddle
#

also unity or unreal?

#

for game engine

brisk badge
#

I'd recommend unity for beginners

faint knoll
#

Hey guys I am trying to recreate Java's variable system from scratch using Java only. I am trying to avoid an error that makes java think I am storing a value of Object datatype to a primitive datatype but this issue wouldn't occur after running. Forget running, the error cannot even allow me to compile the code. Any workarounds?

brisk badge
#

Can you share your code that contains the error?

brisk badge
#

@faint knoll

minor roost
#

Made my own hacked client

candid jay
#

Is it theorically possible to construct a machine learning program to make the perfect pvper

#

Hmm, problem is what to make it learn against

#

It'll have perfect aim and likely perfect cps

#

So if you test it against itself it'll never learn how to strafe and it'll just do crit spamming

#

Problem is, no one will just go and fight a bot for hundreds of hours

#

And deploying a bot in any server would likely result in it getting destroyed/you getting banned

minor roost
#

In the games I'm getting

candid jay
#

ok we just need some idiot with a university degree for cs, knowledge of minecraft programming, and free time

#

I have none of those

minor roost
#

I have the first one, but none of the other three

candid jay
#

If you're a minecraft nerd you have free time

#

And there has to be some guy with a cs degree in his tiny apartment who nolifes MC 20 hours a day

candid storm
faint knoll
# brisk badge <@696017888775241738>

It's huge and I forgor how the code worked... But I remember this. There was an ArrayList with generic type. I use a primitive datatype variable to store values from this array. But the compiler says that Object cannot be converted to that datatype.

brisk badge
#

You cant store primitive types in an List, so it will try to convert that to an Object. An Integer is an object, and behaves practically the same

faint knoll
#

But using some weird hax I found out that during runtime it recognises the datatype but java got no patience.

#

Edit: The ArrayList here actually stores the parent class of several classes and these several classes actually contain the desired primitive datatype variable I want to access

brisk badge
#

So it's solved?

faint knoll
#

no

brisk badge
#

So the arraylist stores parent classes with the same super class and you want to get a variable from the parent classes? If that variable is added to the super class, it should work. I can't really help you if you don't share your code (at least the part that matters here)

formal gust
shadow carbon
#

the dwelling of waffles has found its new anchor

marble bolt
#

The place wherein the sugary syrup topped breakfast pastries reside has totally fulfilled its quest in which it once sought for a new manager of operations.

#

Mic drop

minor roost
#

I guess you could technically define killaura as a perfect pvp machine babyyodasips

tribal summit
#

I mean hacked clients have come really far looking from a development perspective and baritone is also very strong for what it does. But I doubt that this is the furthest we can go. Probably with more machine learning and machines learning from the players more can be done... Will see in the future

#

Though it's gonna be very scary for the anti-cheat developers, since the more a bot mimics humans, the harder they are to detect. Kill aura is for now still visible and distinguishable, image not being able to see it anymore

stone comet
#

Ebk Bob is a ranked in pvp

#

Ffa

#

He's cheating

tribal summit
formal gust
faint knoll
minor roost
minor roost
#

Full of reachers and anti kb

#

They just try to cowardly hide it

candid jay
#

I may be bad but at least I have morals

minor roost
#

And worst part is claiming to be good while using hacks youcannotpossiblybeserious

tribal summit
#

It's an endless war

tribal summit
#

And they try to hide it so well and once the truth is all out, than the endless apologies videos start...

tribal summit
faint knoll
open needle
#

anyone know how to link visual studio code with discord

hard roost
#

Search up discord in the extensions

open needle
#

ok

#

thx

faint knoll
#

visual code is not in extensions?

quiet arrow
hard roost
#

🤔

faint knoll
#

ye I can't find it

#

stop making me so nervous like dis 💀

hard roost
#

find what

spring tiger
quiet arrow
#

omg you have an update!!!! ‼️

tribal summit
#

If it works, you don't update it. Golden rule of programming

minor roost
#

Anyone has a better idea to calculate sum of digits in a number?

#
sum([int(x) for x in str(num)])
tribal summit
#

I can't think of a faster way right now and I don't think python has any functions for that

#

I just asked ChatGPT as well and it comes up with the same solution

hard roost
#

chatgpt will give you a other answers if you specify what you want :)

sum(map(int, str(number)))
tribal summit
#

Oh wow, you make a list of this and sum it together... Nice

candid jay
#

oh that's smart

#

I am too dumb to do for loops in parameters

tribal summit
#

Oh yea. I mean the original is short as well, but that's smart. I don't even think of stuff like this, since we mostly code in Kotlin/C++ in uni these days

tribal summit
candid jay
tribal summit
#

And I don't even remember when and if was the last time I saw it outside of Python

candid jay
#

You can relate anything to hating Minecraft Java

tribal summit
#

Yea, I have to know Kotlin cuz android development 😛

#

Also why do you hate MC Java? I pretty much played only that for ~6 years

candid jay
#

Android(robot) or Android(phone)

tribal summit
candid jay
#

like I've met dozens and dozens of Java MC players, and like 80% think they're superior

candid jay
#

obviously it's phone

tribal summit
#

Maybe I shall program AI and bots one day as well... But not yet 😅

candid jay
#

Anyways I'm currently spinning in my chair because apparently there is a tuple where tuples should not be

#

This causes me minor amounts of sadness

tribal summit
#

:pain:

candid jay
#

Annnnnnnnd I forgot to make it a object

this took me 3 days to figure out

I am a good programmer

quiet arrow
spring tiger
#

surprisingly the latter is slower, wonder why

#

apparently with the latter, it is of type generator, and when sum calls the generator next method, there is overhead there
whereas with list comprehension, it is immediately produced

#

micro optimisiations though. definitely nothing to care about haha

quiet arrow
#

haha, I did not see that coming haha

minor roost
#

Hah me neither

minor roost
#

Typing it on phone 🔥

minor roost
spring tiger
#

What python version is that?

candid jay
#

legend

tribal summit
#

Woah woah woah, do I see coding on a phone 👀

#

That's some next level stuff 😛

minor roost
hard roost
#
def sum_map(number):
    return sum(map(int, str(number)))

def sum_list_comprehension(number):
    return sum([int(x) for x in str(number)])

def sum_for_loop(number):
    result = 0
    for x in str(number):
        result += int(x)
    return result

def sum_list_list_comprehension(number):
    return sum([int(x) for x in str(number)])

def sum_list_comprehension(number):
    return sum(int(x) for x in list(str(number)))

def sum_other_list_comprehension(number):
    return sum(int(x) for x in str(number))
``` With using 123456789 as the number and using timeit to time them will return these
Python 3.10.9
```py
sum_map: 0.7957280999980867
sum_list_comprehension: 1.2387062000052538
sum_for_loop: 0.931918600021163
sum_list_list_comprehension: 1.0424172999919392
sum_list_comprehension: 1.2403143999981694
sum_other_list_comprehension: 1.1307666999928188

Python 3.11.1

sum_map: 0.6343653000076301
sum_list_comprehension: 1.0997384999936912
sum_for_loop: 0.7715334999957122
sum_list_list_comprehension: 0.9352504999842495
sum_list_comprehension: 1.100578100013081
sum_other_list_comprehension: 1.0079370000166818
brisk badge
#

Best to take the one that is most readable ig

faint knoll
#

Also instead of string, try this. Imma write a snippet in java cuz idk what its like in python. (sum of digits)

int result = 0; int sum(int num) { result += num%10; num = num/10; }

tribal summit
#

But yea, with devices getting powerful and having emulators on websites I'm not surprised we're moving in this direction as well

#

Also yea, that's some good old Java code. Pretty much how I would solve the problem before I saw all of the fancy solutions

hard roost
faint knoll
hard roost
#

123456789

faint knoll
#

and the answers are in decimal?

#

java best WiiUwU

faint knoll
tribal summit
#

That do be true as well actually. Maybe it's just that I have been on my computer way to long and have kinda gotten used to it by now

#

But yea, I can't argue that it's opening doors for many others to start coding as well

hard roost
brisk badge
hard roost
#

hard roost
lusty pagoda
#

@brisk badge SkyWarsEGG

brisk badge
faint knoll
hard roost
#

until it isn't 😱

quiet arrow
#

How many times are you doing it?

#

For the timer

hard roost
#

that was 10000 but the inputted number was 123456789123456789123456789123456789123456789123456789123456789123456789123456789

#

Going to default amount and with that abomination of a number will yield sum_other_list_comprehension as the winner

#

python 3.10.9 btw

quiet arrow
#

lol scheme slower

brisk badge
hard roost
spring tiger
#

well, sum list comprehension. the whole rule of pythonic is the most readable code 😛

hard roost
#

sum for loop is the better alternative if we want readable code

#

and its faster too (than sum list comp)

faint knoll
#

ok

#

I just told what I have been taught in school

minor roost
minor roost
#

not really

#

its just how mobile is

faint knoll
#

Practice makes both man and woman perfect

#

Nah man

#

Currently I am typing with just one hand

#

One finger

#

Lol

#

Beat me to this

minor roost
#

On average typing on keyboard is much much faster than on mobile device

#

the screen is bigger

#

U have a mouse...

#

I higly doubt that mobile is a future for coding

faint knoll
#

Ok imma say it just depends on preferences

tribal summit
#

I'm still on team computer and I suspect most people are as well... But I'm sure we'll find some people that like phones or can't afford a comp. Though long term that's not sustainable because python and stuff like that can be run on phones, but I'd like to for example see it run Android studio 😛

faint knoll
#

Btw keyboards are big and you need more time to move your hands and fingers

#

And eyes need to move more than while using mobile

#

With mobile I can just chat with one eye open and with my index finger

tribal summit
#

Okay, fingers have to move slightly more. But when you have that "blind typing" locked in it's not that much longer or anything. I mean here, I can chat with both my eyes closed for typing, since I know the keyboard. But as it is with everything, there are benefits and minuses

faint knoll
#

Yes even coins have two sides

#

Btw blind typing can also be done for mobile

#

Then you can even talk with others irl while typing

tribal summit
#

When it comes to coding I'm sticking to my comp, but if someone prefers to use a phone and is actually good at coding on it, I say that's fair as well. I just know, I couldn't do it myself

faint knoll
#

yes man let's just not go on with this controversial topic

#

@tribal summit how about tablets for coding?

#

Huge screen yet more portable than pcs

spare nova
faint knoll
spare nova
#

Idk if they have keyboards for the touch screen I've never owned one

#

Mb

faint knoll
#

Ok

tribal summit
#
  • Very portable and longer lasting battery
faint knoll
#

chromebook

quiet arrow
#

I don't think any one would choose to code on phone over a PC

#

I doesn't matter how fast you type, you're not actually typing a lot anyway. I think seeing more code, and being able to navigate your files faster has way more influence than being able to type your for loop 2s faster

faint knoll
#

Also yes there's google drive

#

Just store your code there?

candid jay
#

I have higher wpm on phone than computer

quiet arrow
#

I can switch files faster on PC while working on a project than on Phone?

candid jay
#

I will die if you ask me to do programming on phone

true mantle
#

What was the code to send a message to another user dm's -> If I warn someone that the one that got warned receives a dm - I now have interaction.member.send({ embeds: [embed] }); but that sends the dm to the one that used the command (I already tried target instead of member) I use discord.js

slender lynx
#

You'd need to fetch the user first

#

Handle error for closed dms accordingly ^

#

Ideally it's client.users.fetch('ID') then you can use the .send() method or fetch via cache client.users.cache.get('ID') then use the .send() method

true mantle
#

@sharp crystal mac got muted for sending a code on a website

candid jay
#

F

true mantle
#

@slender lynx u got unmuted can u send the link in my dms?

slender lynx
#

You get muted for sendiing links?

#

dang that's sad. I appealed just now because I didn't know its a short mute

true mantle
#

u need to contact a mod if u get muted

slender lynx
#

I appealed yeah 💀

true mantle
#

but some links are whitelisted

slender lynx
#

oh yeah sorry mod

#

It wasn't a harmful link

slender lynx
true mantle
slender lynx
#

I sent the link in dms tho, sorry for any issues here 😅

faint knoll
quiet arrow
dawn parcel
#

don't you get it as a readymade discord.Member type object which you can directly use .send on?

slender lynx
#

He wants to send it to a specific user

#

Interaction user is the user that invoked the command

dawn parcel
#

ehm yeah that specific user is going to be an argument in the slash command which would take input of a discord.Member object

slender lynx
#

Depends how it's done

#

if used in slash command then yes

#

if used in a message form then no

dawn parcel
dawn parcel
#

interactions resemble slash commands, message app commands or user commands or modals etc

slender lynx
#

The ID I mentioned is a specific user.

#

regardless of which guild they are in

#

client.users checks across all users not guild

dawn parcel
#

no no i think that's not what he wants

slender lynx
#

They said that they want to dm the user on a warning

#

so ideally that's how it can work

dawn parcel
#

for example he uses /warn @user then the user gets a dm i think that's what he wants than a static user being dmed

slender lynx
#

you can use the guild member manager or client users

#

both work

#

depends on how you implement is

#

guild member manager ensures that the user is actually in that server

#

with client, it doesn't

dawn parcel
#

hmmh you must be right, i have no idea about discord.js bot development :P

#

my main is discord.py and it's like completely different

slender lynx
#

i see

brisk badge
candid jay
brisk badge
candid jay
#

I'm not blaming anything

#

I'm just bad at typing on computer, period

faint knoll
#

tru

minor roost
minor roost
#

I understand that to certain extent its all about person's likings but there are facts you cannot ignore

candid jay
#

just tested

#

I used to be wayyyyy faster

plush walrus
#

no

#

just no

#

vim users 😉

faint knoll
#

||GitHub is so complicated||

minor roost
eternal bronze
#

Certified normal ide user

short nest
#

who is a good pocketmine dev here

tribal summit
#

Plus yea, command prompt and using commands to navigate the folder system can make it so much faster...

slender lynx
#

Google drive is nor designed to handle "code". GitHub is made for that purpose

#

At the end of the day, if you store your files in Google drive, GitHub or locally. It all falls down to how easily you want to access them.

faint knoll
slender lynx
#

Everything is usable but in an ideal world if you work for a company, they will choose GitHub over google drive

#

and they would choose Google drive for storing images / videos or PowerPoints etc rather than GitHub because GitHub isn't made for that

short nest
#

i need a good dev

slender lynx
#

for what

short nest
#

for packs

#

recource packs

slender lynx
#

def not me

short nest
slender lynx
#

nah

short nest
#

k xd

minor roost
faint knoll
#

And it's ez given mobiles fit in hands more easily

minor roost
faint knoll
#

ight later I will

short nest
#

I need a developer dm me

minor roost
#

Oh wait I replied...

#

Frick

minor roost
short nest
short nest
#

No problem

minor roost
# short nest Why
  1. Nobody sane will work for free
  2. Not specifying field
  3. Not specifying job description, requirements etc
#

Can keep on going

#

Also you are making them dm you, which is extra work while you can't even spend some time to create a meaningful message

short nest
#

Lol

minor roost
faint knoll
#

Also you can make a zip of a folder and save on google drive in case you want to download the entire folder later on

plush walrus
#

gdrive is not version control software

#

but storage

minor roost
#

Like kristiankunc said google drive is not version control

hard roost
minor roost
#

gdrive has no workers no piplines no ability to manage your developer team no commits no branches no ability to easily see changes, roll back and revert them IT IS NOT VERSION CONTROL

hard roost
hard roost
#

Also you can make a zip of a folder and save on google drive in case you want to download the entire folder later on
And guess what! You can do that on Discord too! Still doesnt mean its version control

hard roost
brisk badge
quiet arrow
minor roost
#

I-

minor roost
faint knoll
faint knoll
#

Also multiple people can work on a document in google drive

plush walrus
#

multiple people can work on document on git

faint knoll
#

so google drive best for low-budget use 👍

plush walrus
plush walrus
faint knoll
#

google drive is also free-

plush walrus
#

you said to use ide with a version control

#

like?

faint knoll
#

ok Google says version control means keeping the software updated. Use MS visual studio code?

faint knoll
faint knoll
#

ok then I don't really understand version control, my apologies.

hard roost
faint knoll
#

respecting Bill Gates...

#

||GitHub got more terminologies for namesake than actual daily utilities|| 💀

hard roost
faint knoll
minor roost
#

eh

hard roost
#

Smartest conversation in Ohio

minor roost
#

Lttrly

#

@faint knoll If u wanna code for life, sooner or later u will need to use git

faint knoll
faint knoll
minor roost
hard roost
faint knoll
minor roost
faint knoll
#

ikr

#

useless

hard roost
#

Does google drive execute code

faint knoll
#

nope

minor roost
faint knoll
#

I have GitHub account dude

#

It's linked

faint knoll
#

ok

minor roost
# faint knoll ctrl + z

If u ever make a program bigger than

while True:
  print("Google drive > everything else")

U will understand why Ctrl Z is not an option

faint knoll
#

why did they think of like changing the name "folder" which we all love and remember, to "repository"?

#

that's one example I can remember now

minor roost
#

You are right

#

Slay queen 💅 💅

faint knoll
faint knoll
#

it's just about resourcefulness buddy, not fanciness 💀

minor roost
faint knoll
hard roost
faint knoll
#

yk

#

Also I didn't save them on google drive

faint knoll
minor roost
faint knoll
#

Cuz my pc has enough storage?

minor roost
#

This convo makes my head hurt

faint knoll
#

ok

#

Have some tangine 🍊

minor roost
#

Ty

#

already better

hard roost
minor roost
#

there is nothing google drive has that github doesnt

faint knoll
faint knoll
minor roost
#

With github, with one click of mouse, i can run code tests, commit + push and run CI/CD piplines to automatically deploy code to virtual machines

hard roost
faint knoll
#

Google drive + ms visual code= store, code, debug, execute

hard roost
#

Only thing it's optimized is for google's products not code

faint knoll
#

What else could one ask for

#

Nvm bois

#

Y'all go fancy, imma think simple

hard roost
faint knoll
#

Download ez

#

or share link

#

I think there's also one writing tool in google drive

minor roost
hard roost
#

Do code in python jocky

faint knoll
minor roost
#

😭 😭 😭

faint knoll
hard roost
#

Smartest coding conversation in Ohio

quiet arrow
#

what in the world did I just read

faint knoll
#

Ikr

#

🗿

minor roost
#

There are 4 options i see:
You are either:

  1. very drunk
  2. very dumb
  3. too proud to admit mistake
  4. or you are trolling
#

pick one

faint knoll
#
  1. I'm simple and resourceful
minor roost
#

Slay 💅

faint knoll
#

King*

minor roost
#

Eh

#

Is there anything that would change your opinion about Google drive vs github?

#

@faint knoll

faint knoll
#

I'll think about that in future ig

minor roost
#

me who just stores files on the hard drive

faint knoll
minor roost
#

hdd so cheap now

tribal summit
#

I was very confused while I was reading this conversation... Very confused.

#

Also yea, GitHub is pretty much life for me already

faint knoll
tribal summit
faint knoll
#

We submitted our interschool programming competition code on google drive

tribal summit
faint knoll
faint knoll
#

Tell nobody this:
||I got access to other school's code cuz they sent wrong link||

faint knoll
tribal summit
#

INR?

minor roost
#

what's inr

faint knoll
#

Indian boi

#

Most American chat in Ohio

tribal summit
#

1€ --> 88.73 INR
1$ --> 81.72 INR

minor roost
tribal summit
#

Now just multiply all our numbers and you get rupees

faint knoll
#

My budget: 10 INR for a pack of chips

minor roost
#

that's dirt cheap what

tribal summit
#

Yea, than you're sadly not getting a new disk :/

faint knoll
#

💀

tribal summit
#

Also 10 INR for a pack of chips?!?!?!?!?!?

#

It costs a few bucks where I live

faint knoll
#

Only in India

minor roost
#

chips run me like 1.50

faint knoll
#

Americans won't understand

tribal summit
faint knoll
#

But Minecraft surely costed you guys like 5 or 10 dollars

#

meanwhile in India...

#

🗿

#

Around 600 INR or more

tribal summit
#

I'm a college student, college students are usually broke. Man if my chips were 10-20 cents, I'd eat the every day xD

tribal summit
minor roost
tribal summit
#

It's around 25€ - 30€ today

tribal summit
faint knoll
# minor roost 27$

Imagine minecraft at 27 INR. Two big pack of chips and one pack of small chips and one toffee

#

Perfect Christmas gift

tribal summit
faint knoll
#

Guess we are too rich 💋

tribal summit
#

The west is supposed to be rich 👀

faint knoll
#

nah it's the parallel universe

#

Jk yes that is why it costs you guys more

#

The valuation of your currency is just a lot more than ours

tribal summit
#

We have a very strong currency right now...

#

Tough, you play pocked edition or anything else?

faint knoll
#

pocked edition

#

🤜🤰

#

amazing

tribal summit
#

Oh okej, that's cheaper for us as well, so it's not that big of a difference

#

We just play Java/Windows 10 edition

faint knoll
#

moneys

#

Mcpe costed 500 INR nearly

tribal summit
#

Yea, pocket edition is cheaper... But that's understandable

faint knoll
#

||kindly donate haha||

minor roost
#

fr

candid jay
#

Google drive, jesus

faint knoll
minor roost
#

go to europe

faint knoll
#

I'm Indian dude

minor roost
#

u r from india prob

faint knoll
#

Moneys

#

Yes

#

Poverty

minor roost
#

Welp

faint knoll
#

British took everything

minor roost
#

ik

faint knoll
#

💀

minor roost
#

💀

faint knoll
#

F briish

minor roost
#

Well

faint knoll
#

they need to gimme visa now

minor roost
#

yes

faint knoll
#

I also have less to no IRL friends, prolly America could have better friends

minor roost
#

But like im self tought

#

like prob most of ppl here

faint knoll
#

cool

#

Ok gn

minor roost
#

u dont need to go to good school, at least not at the begining

faint knoll
#

ik ik

#

but here in India

#

🗿

#

competition

minor roost
#

U can learn basics yourself, if only you are willing to learn and hear advices from ppl

#

(LIKE FOR EXAMPLE TO SWITCH TO GITHUB)

faint knoll
#

(GOOGLE DRIVE BEST)

blissful saffron
#

Algun br skay wars?

faint knoll
#

I'm trying man

minor roost
faint knoll
faint knoll
minor roost
#

Wont be good night for me

#

my head hurts after the previous convo with you

#

IDE - Ink Drawing Enviroment
(My computer teacher in school)

faint knoll
brisk badge
quiet arrow
#

Sounds like me exam last year

brisk badge
faint knoll
minor roost
#

Why not always stick with your IDE of choice?

#

Why be in need for "last minute editing" in notepad 😭

#

I swear your solutions are counterproductive

cyan glade
#

plugin de cubecraft xd

quiet arrow
#

vim? nano?? cursed_flushed

brisk badge
quiet arrow
#

True true

minor roost
#

With a paper and pen you are only limited by your imagination

faint knoll
candid jay
#

why

faint knoll
#

Because

quaint wraith
#

Does anyone want me to make functional chest shop or crate system in his world?

#

I have a command knowledge for this

#

I mean I am not a command_block master but still I am pro about it...

#

In 1.19
Execute command has changed

#

That's why I am asking

brisk badge
#

Java or bedrock?

minor roost
#

does bedrock even have command block system?

spring tiger
#

yes absolutely

mellow basalt
#

C

minor roost
#

B

paper rain
#

A

brisk badge
# quaint wraith Does anyone want me to make functional chest shop or crate system in his world?

From your remark about the new execute command, I assume that you are talking about Bedrock Edition. However, on bedrock, there is no way to get NBT data of blocks. This makes it impossible to know what the contents of a chest are, without breaking it. If you dont have a way to know that, you can't really detect on which item the player clicks. There might be a way with custom ui's and resource packs, but that is a lot more complicated.

#

On Java, you can check the contents of a chest with the amazing data command. When a player removes (or moves) an item, it gets removed from content list of the chest, so you know the player has clicked on that item. You can then place the item back. The mechanic is doable, but it can be quite time consuming to build an entire shopping system this way.

#

Besides, this method is not very bugproof too. You can, for example, easily duplicate the items in the chest.

tribal summit
faint knoll
#

also I think there is some command which allows to map the loot crates ig..

#

like with a loot table

#

PS: I was just searching if Oppo is better or Redmi for gaming, guess I now have to know Android rooting for that (security issues and minecraft worlds access) 😢
Buying a new device took a whole new turn for me. Any advices anyone?

minor roost
#

With that budget? Buy a console

dawn parcel
#

iphones and other phones are prob not the choice for gaming imo

#

samsung and oppo play games at 60hz my friends told me, they can't play on 90 or 120

#

oh also on redmi phones you can use stock Android too if you'd want, you just need to unlock bootloader or smth and do smth with your pc to install that

hard roost
hard roost
hard roost
minor roost
#

fortnite

quaint wraith
quaint wraith
#

like give @p diamond 1 100

#

bc

#

you can not claim the data

#

when you mine some diamonds

#

it will automaticly gives us data 0

#

but when you get it with commands

#

you can get data 100

#

and that would do the work I guess

#

Like I made a crate system

#

in my bedrock server

#

I am not going to tell my server name bc it will against the rules

#

🙂

faint knoll
#

Rest include like the default apps can't be disabled and ads come from those bloatwares.

tender wharf
#

Hello guys 🙂

faint knoll
#

Btw iPhone allows only select apps to be downloaded and is too costly. Gaming mobile also high price. Pc ew.

#

Overall budget is a major issue

minor roost
#

Then buy a console 😭

#

Or save money for later to buy a good pc

brisk badge
brisk badge
faint knoll
#

Btw see my next message also

brisk badge
#

@quaint wraith I've just thought about a possible solution for you: place another chest with exactly the same nbt data (so same rotation, items (in the right slot!) etc. Then check if the two chests are the same, and catch the boolean output with a conditional chain command_block. A bit messy, as you cant use function files for your whole project.
If you want to make sure that it will always keep working (with future updates) you can clone the chest elsewhere, break it, and check the items that have been dropped.

quaint wraith
#

Btw Have you got an solution for chest ui?
I mean I am making on commandblock and it is very hard bc someone can steal stuff

#

I am making shops with it

#

:/