riedlerod / basav Goto Github PK
View Code? Open in Web Editor NEWPython application that visualizes Sorting algorithms. Much more focus is laid on giving actual information from the visualisation than making pretty sounds and looking cool.
Python application that visualizes Sorting algorithms. Much more focus is laid on giving actual information from the visualisation than making pretty sounds and looking cool.
planned would be a dict where algorithms can choose up to 20 settings by defining a member like so:
opts={
"base":(int,4,2,None,"Base"),
"oop":(bool,False,"Out-of-Place","In-Place"),
"version":(list,2,("This","That","Ananas"),"Version: %s"),
…
}
, where the option "base" is an integer from 2 to infinity, and a default value of 4, "oop" is a bool with the default value False, where "Out-of-place" is displayed for True and "In-Place" for False, and "version" is a list (a flip-through button in the UI) with the item on index 2 in "vals" being the default. If an option is defined with illegal values, e.g. the default value being out of range in an int, or the possible values in a list being less than 2. If there are more than 20 settings, the additional ones should be hidden and set to their default values. (maybe the maximum amount of settings will increase in the future if demand arises)
The options can be set by the user and on algorithm start, the selected values will be accessible to the algorithm like so:
def gen(self):
b=self.vals["base"]
oop=self.vals["oop"]
v=self.vals["version"]
…
Then the algorithm can modify itself with the specified values as it pleases.
This feature is aimed to reduce the amount of unique algorithms to select in the algorithm selector drastically and increase the amount of different options a user can choose from. E.g. the Radix LSD algorithm alone used up 6 spaces, but only base 2,4, and 10 can be selected, with an additional OOP option.
Planned is the setup:
Sorting algorithms have to make sure all possible configurations are functional. E.g. if there's a base 4 OOP version, but not a base 7 OOP version, then the algorithm should either limit the possible bases, scrap the OOP versions alltogether, or make the combination work. Note that there can be set boundaries which integer values are possible, but no single value can be excluded. If its a finite list, consider using a list instead.
add a button that disables safety checking for a (more or less effective) performance increase. All algorithms should be stable anyway, so safety checking really is just for implementing and testing new features. I still want an extra layer of stability that's enabled by default so the program doesn't crash if I mess up.
Either:
Read: n
Write: n
Pass: n
Or:
Read: n
Swap: n
Insert: n
Bucket: n
Pass: n
I haven't decided yet.
my ears aghh
I just want to see if it works, only major bugs will be fixed, but all bugs I encounter will be recorded.
Also, I don't have windows right now, so I'll ask someone else to try it while recording the screen.
Converted Entities:
A mode where inserts are emulated through swaps. The algorithms are still able to use the INSERT and BUCKINSERT actions, but those will then be translated to the according SWAP actions by BASAV.
This won't be a problem as long as no BUCKINSERTs are done, as those cannot be done through other actions. To solve this problem, a new action will be introduced. See #21.
I should fix that.
I tried to fix it, but it doesn't work.
Onto the next feature request.
when pressed, the button should
This button will be useful for several purposes:
Newest on top:
commit fd3fe1274d60756ecfcbe3eb525955ecfa8ca26e
Greatly improved audio playback quality and performance
UPS|FPS
59|59 Without Load
(Sound OFF)
48|24 Merge Sort
55|34 Radix LSD 10
28|14 Radix LSD 10 OOP
(Sound ON)
40|23 Merge Sort
48|31 Radix LSD 10
25|14 Radix LSD 10 OOP
commit a4c499acfcb00dfeea62d0b488c4886108ac679c
Added a button to disable audio and a better way to get the average UPS/FPS
UPS|FPS
59|59 Without Load
(Sound OFF)
58|56 Bubble Sort
47|24 Merge Sort
56|35 Radix LSD 10
29|14 Radix LSD 10 OOP
(Sound ON)
32|16 Merge Sort
37|19 Radix LSD 10
22|14 Radix LSD 10 OOP
commit 5339da37ef1e2343c8fa91659cf63acddaf7da4e
I changed the wact/ract rendering system from setting all possible vertices and then assigning the colors when needed to generate an amount of verteces in the correct x positions below the screen and updating the y corrdinates when needed.
UPS|FPS
59|59 Without Load
40|25 Bubble Sort
30|17 Merge Sort
35|16 Radix LSD 10
23|13 Radix LSD 10 OOP
commit 7d74706a3926c7ea480eee2d0f20d21931ced469
added somewhat capable audio playback here
UPS|FPS
59|59 Without Load
38|24 Bubble Sort
30|14 Merge Sort
37|17 Radix LSD 10
18|10 Radix LSD 10 OOP
commit 40b01d61286e6377748172185b765334af01c082
"much much faster rendering system"
UPS|FPS
59|59 Without Load
58|49 Bubble Sort
40|20 Merge Sort
50|25 Radix LSD 10
25|12 Radix LSD 10 OOP
For better algorithm control and the possibility of #20, a new action PULSH will be added. This will allow the Algorithm to PULL an item from the end of a bucket, and then PUSH it onto another one. There will also be the PUSH and PULL actions for storing one item while doing other stuff. They will be callable for algorithms through the following action:
yield (PULSH,buck1,buck2)
or
yield (PULL,buck1)
yield (PUSH,buck2)
where buck1 is a bucket with at least one item and buck2 is a bucket with at least one empty spot (which is a given in BASAV if buck1 isn't empty).
Pulshing any item that isn't at the end of a bucket to a position that isn't at the end of another bucket is possible through insertions, which defeats any performance gains PULSH would have. Which means it's not an action to make current algorithms faster, but to distinguish technically faster PULSH operations and usually slow BUCKINSERT operations in the stats. Also, as mentioned above, for insertless mode.
The PULSH operations will count as one PULL and one PUSH in the stats.
Should be somewhat possible to implement something like this with a few new actions:
and Algorithm callbacks:
Threads should be handled like separate algorithms, where each non-waiting thread gets called equally often than the others. This should be implemented by calling them 'in a circle'. If an algorithm yields to wait, the member thread.lock should be set to the number that is specified. Every time a thread should be called, its member thread.lock has to be read & checked. If the lock is currently locked, the thread should not be called & it should continue with the next one. If a full round has been completed without a thread being called, the algorithm should be stopped and the user should be notified (per print) that a deadlock has occured.
It'd be nice not having to fear that some weird window member could get overritten by a new logic member.
It should be split like so:
The new class MainWin()
will go into the CONSTANTS.py
file, along with its invokation as win
and the constants that get set regarding window size. The new class MainLogic()
with most of the members and functions from the current GameWin()
will stay in the main.py
file.
So you can change the algorithm without changing the source code
because the current one is unnecessarily complicated & yielding stuff would make stuff way easier.
The only problem I still have to solve is passing the read values.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.