Jump to content

Banking code


Nbacon

Recommended Posts

Thanks for asking

12 hours ago, Jarl said:

This seems interesting but I feel like it's a waste of memory because the api can check for many of these properties. (stackable/notable etc)

For me its justified for a few reasons

  • I don't know were that Info is stored (I know there is ItemDefinition) but I don't know how to get a id->ItemDefinition.
  • For speed if there was a map of id->ItemDefinition yea its fast but this is an array and they are always "O(1)" Access 
  • Waste of memery (look in ItemInfo.kt   they are boolen and char arrays the H2,FEET,WEAPON items are not ues in this porgram are not expleitly used but all that info is in the object called 'test' thats a char array)
    •  its only 3.5kb (in c no idea for java and its overhead) so each stackable,notable,noteable if make them  BooleanArray as I do.
    • The equipment slots can be golfed into an array of chars length 15000  or about 16 kilobytes (in c at) (I have it set up for non golfed at about 30000 chars 32kb )
    • So the total space those files take in memoery is less then 50kb or the same.
12 hours ago, Jarl said:

I feel like this might be useful for checking equipment slots, but outside of that it's not very useful. Or am I missing something?

I don't know what your looking at or thinking (not a mind reader).  This solves a search space in this cace the search space is taking items out of the bank to meet some goal. If you ran it you would say holy memery use because the defalt problem in Main for me at least can take like 1 gig of memory to sovle the space [but that is an extreme] you can break it down into 5-7 chucks to save memory that java likes to hold on to. 

 

I make a video of what it does. 

 

At the moment Im working on a off client prossors that will hopefull bring down the memeory uses of my dumb just for fun progects....

 

 

 

 

 

 

 

Edited by Nbacon
Link to comment
Share on other sites

1 hour ago, Nbacon said:

I don't know what your looking at or thinking (not a mind reader).

Actually, I was thinking osbot api requires you to know the slots of equipment to check if something is equipped. I'm quite new to osbot and I admit I only skimmed through your code quickly. I did not know the api had a method to check the slot of equips but after looking at your code again I see I'm wrong 😛

1 hour ago, Nbacon said:

For speed if there was a map of id->ItemDefinition yea its fast but this is an array and they are always "O(1)" Access 

I had thought of this, but I was thinking there is not much overhead with using osbot api to find items. It may theoretically take more but it is almost negligible because you are finding 28 items at most. I don't doubt your method is good and fast. But my thought was that using osbot api is not that slow. How are you taking 150s to find 28 items? In my mind I'm thinking even if your bank is full it is not a difficult task to find 28 items, though I must admit I had not tested my bank methods with a full bank.

I don't know why java takes up so much memory, maybe it's a situation of linux ate my ram. When I make new instances of classes, I can use 10+ more MBs of ram although the plain text size is small. Maybe I am just not knowledgeable enough yet.

 

Edit:

Just wanted to add on, I had made a bank method recently so I thought this might be helpful for you. You can make an array of all the bank areas and if you are not in a bank you can use a stream and webwalk to a closest bank. I thought that was a pretty good idea because you can just put it into any script.

Edited by Jarl
Link to comment
Share on other sites

5 hours ago, Jarl said:

How are you taking 150s to find 28 items?

its (* 20seconds ) for 28 different Items... becuase it tried all possibilities.  I think its 28! ways to pull out 28 items with pre prossesing and pruning the space becomes  alot alot alot less. I bet If I add more rules it could run in 1 secound.  but what are the odds that a user will pull out 28 diffent items...

In the video you can see that it withdraws,deposits,swaps items, puts on items, takes off items in the best way possible... 

 

5 hours ago, Jarl said:

It may theoretically take more but it is almost negligible because you are finding 28 items at most.

It theoretically takes the same time but in practice 1 access vs 1 hashing+lookup+maybe a small search adds up when you do it millions of times.

 

 

Found a speed up for 28 items in 2 seconds and major memory saves

 

Edited by Nbacon
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...