python – How to balance ‘efficient’ vs ‘clean’ code?

I have been coding in python for a little over a year, and I have learned a lot and developed quite a few applications, in the process.

I do not program for my profession, I simply program recreationally. With that said, I am not exposed to new programming techniques/data structures etc., that I would be learning if my day job was in the field, for example.

I have become quite good at figuring out what I want to do by trial and error in python, and I am usually pretty successful at figuring it out!

However, sometimes when I learn something new, I will find that I was doing it the long way or with way too much code that could be much more easily accomplished with fewer lines or a technique that makes an algorithm more efficient.

When you are developing software, do you strive to find the most efficient way to do something first, or do you simply code the way you are familiar?

I don’t have many programmer friends, so I have been doing this all pretty much on my own.

I watch a few twitch streams, but beside that I do not really know anyone in person.

Hopefully that adds some context why I am asking.

blockchain – My available balance is different then my total balance [ URGENT HELP NEEDED ]

I receive many transactions daily for the past year and i haven’t withdraw any sort of amount for the past year, today i decided to do so and came up with this annoying problem.

As you can see (Photo 1) that’s my current balance of around 0.55 BTC and as soon as i go to the send page it says the same (Photo 2), but when i put the wallet address to sent the BTC to on the bottom left it says my spendable available balance is 0.35 BTC (Photo 3) and that if i press the max button you can see that the fees are of 0.0011 BTC. (Photo 4) and they’re only letting me send 0.35 BTC which doesn’t add up.

Does anyone know what’s going on?

Is it possible that Blockchain hasn’t made all my bitcoin available for me to send?

Do i have to send this transaction first and then i would be able to send the rest?
Which should be 0.22 BTC (missing but shown on my total balance)

Tried contacting support they keep saying its fees which is not the case i can cover my fees like 10 times lol its just there’s a problem somewhere in my wallet or on the app/server.

enter image description here

enter image description here

enter image description here

enter image description here

balance – Manual of Bodily health abuse?

balance – Manual of Bodily health abuse? – Role-playing Games Stack Exchange

balance – How to design initial difficulty progression for a dungeon crawler without it feeling boring?

I’m at a stage where I’m trying to design an initial world or set of levels to help me think about and test progression in a dungeon crawler. For some reason this has really stopped me in my tracks. I know that I want my player’s heros to get stronger, and I want the game to get more difficult so they can’t over power anything. This really is the game loop anyways.

So what I tried to do to distill the progression design down is to literally focus on nothing but HP and Damage increase. How do I make this interesting if the player power and enemy power looks something like this:

  1. Level 1 Hero has 100HP/10DMG, Level 1 Enemy has 50HP/10DMG
  2. Level 2 Hero has 200HP/20DMG, Level 2 Enemy has 100HP/20DMG
  3. Level 3 Hero has 300HP/30DMG, Level 3 Enemy has 150HP/30DMG

As you can see, the balance ratio between the two always stays at 2:1. The fight will take the same amount of time. It will look the same from HP bars losing life. Why would the player keep wanting to play or even care about leveling up if this is how the game goes? This isn’t fun. It isn’t interesting. But it is a linear balance curve of 2:1. Ok, I’ve designed that I guess.

So of course the next step is to make the player be stronger than the enemies for a bit after they level up. They want to feel strong, right? Well how long do I do this for? How long do I wait until I make the enemies stronger and challenging again so the player wants to level up to get stronger again? How do I know exactly how strong a hero will be at each level in my world?

That’s one problem.

The second thing to consider is that simply giving stat increases is incredibly boring. So instead, I’d like to give the player’s spells and abilities which effectively increase their HP or DMG. How often do I give them these? How do I keep it fun between levels? How do I know how strong a hero will be at each level in my world?

I think looking at it this way has taken the magic out of the game and design, but is there any other way? How do I get past this and is there common ways to look at this type of hero vs. enemy/level balance?

balance – Is the magic system in the XD20 roleplaying system unbalanced?

I haven’t played XD20, but I have played and GMed using other “microsystems”, such as Roll for Shoes and Simple D6, that are based on similarly flexible “player decides what they want to do, DM sets difficulty, player rolls” mechanics.

Based on that experience, I’d say a system like that is exactly as balanced as the DM wants it to be.

If the DM wants to play favorites or just be randomly inconsistent, they obviously can be. And if they want to be reasonably fair and balanced in setting the difficulties and narrating the degrees of success, they generally can also do that.

Of course, being only human, they probably won’t be able to make different characters with different abilities perfectly balanced. But then, no system can do that. And at least, since this system does have a human in the loop, they can dynamically adjust the balance if they notice during the course of play that one character is being a lot more successful than another in a way that makes the game less enjoyable. With more mechanical systems, like D&D, the DM has fewer options for that (although fewer certainly doesn’t mean none at all).

How to load balance TCP connections using GeoIP?

What would be the best free solution for connection load balance using GeoIP for source of connections?
Let me explain: I have about 6000 clients worldwide running and application that receives signal from RF frontend. Some of these signals doesn’t have one specific data that we need (location), so we have a server (called MLAT-SERVER, Opensource) that do multilateration analysis and return the result to clients. This MLAT-SERVER requires, at least, 3 clients sending the same signal (therefore those clients must be close and connected to the same server).
This proccess is very heavy, so we must split this into 10 or more servers…..but, again: close clients must be connected to the same server to proccess the same data.
My question is: what’s the best software for this? I would like to segregate servers by regions (Europe, Asia, etc..), but with possibility to split by region of country too (ex: USA-North, USA,South, etc..).
The connections uses a custom TCP and a custom protocol (nothing like HTTP or FTP) and are stick connections (keep connected forever).
I’m not sure if HAProxy or NGNIX can handle this type of connections or have GeoIP functionality.

c lightning – pyln.testing channel’s spendable_msatoshi remains 0 in the direction towards the funder, regardless of balance

The python test script below (using the pyln-testing library) opens a channel between l1 and l2, and then the funder (l1) pays half of the channel’s capacity to l2.
After this payment ‘l2’ wants to make a smaller payment to l1, but this payment fails for reasons I will explain below the script.

Test script

from pyln.testing.fixtures import *  # noqa: F401, F403
from pyln.testing.utils import wait_for, DEVELOPER
import unittest

@unittest.skipIf(not DEVELOPER, "gossip is too slow if we're not in developer mode")
def test_two_way_payment(node_factory):
    """Send a payment to and fro
    l1 ---- l2
    """
    opts = ({},{})
    l1, l2 = node_factory.get_nodes(2, opts=opts)
    
    capacity=10**6

    l1.openchannel(l2, capacity=capacity)
    
    # Now wait for gossip to settle and l1 to learn the topology
    wait_for(lambda: len(l1.rpc.listchannels()('channels')) == 2)

     # Get all channels balanced (by paying money to the other node)
    l1.pay(l2, capacity // 2)
    l1.wait_for_htlcs()

    print("LISTPEERS L2: {}n".format(l2.rpc.listpeers()))

    l2.pay(l1, capacity // 20)
    l2.wait_for_htlcs()

The script above fails with the error below

Error

Fail: pyln.client.lightning.RpcError: RPC call failed: method: waitsendpay, payload: {'payment_hash': '6d1281627828720bd86cb2815f222a8c0106545d7d4f972e5ec5324133163224'}, error: {'code': 204, 'message': 'failed: WIRE_TEMPORARY_CHANNEL_FAILURE (WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded - HTLC fee: 7964sat)', 'data': {'id': 1, 'payment_hash': '6d1281627828720bd86cb2815f222a8c0106545d7d4f972e5ec5324133163224', 'destination': '0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518', 'msatoshi': 50000, 'amount_msat': 50000msat, 'msatoshi_sent': 50000, 'amount_sent_msat': 50000msat, 'created_at': 1623829593, 'status': 'failed', 'erring_index': 0, 'failcode': 4103, 'failcodename': 'WIRE_TEMPORARY_CHANNEL_FAILURE', 'erring_node': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'erring_channel': '1x1x1', 'erring_direction': 0}}

Listpeers

If I lift some information out of the listpeers rpc call for l2 I can understand why the payment wouldn’t work:

'msatoshi_to_us': 500000
(...)
'spendable_msatoshi': 0

What I don’t understand is why ‘spendable_msatoshi’ would be zero. It can’t be because of the channel reserve. I don’t think it can be because of enormously overestimating the on-chain fees (in case of a forced close) because the l2 isn’t the funder.

What am I missing/not understanding here?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies