Chatbox
October 2017
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Calendar Calendar

Latest topics
» The AFK thread
by Tecuani Mon Nov 25, 2013 5:15 am

» Basic - Camouflage and spotting - 26th of November - 19:30UTC
by ZerONRNS Mon Nov 25, 2013 4:42 am

» SGTA is moving!
by Vallu01 Sun Nov 24, 2013 9:57 am

» Trying to understand the T-34...
by Vallu01 Sun Nov 24, 2013 3:53 am

» Hello from Prometheus
by Pendergast Sun Nov 24, 2013 2:15 am

» Repeat of peek-a-boo lesson?
by JosefSvejk Sat Nov 23, 2013 10:57 pm

» M46 Patton, wat to do .vs TD division
by Rajahz Sat Nov 23, 2013 9:46 am

» T-44 Patrol Duty
by Wen90 Sat Nov 23, 2013 4:45 am

» Peek a boo lesson
by Madhias Sat Nov 23, 2013 3:51 am


I've written a small program (WoT related!)

View previous topic View next topic Go down

I've written a small program (WoT related!)

Post  Niflhel on Mon Aug 19, 2013 2:42 am

Hey folks.

I've very recently started learning Python, a programming language. I initially started creating some small and rather boring scripts, but after I had spent around 10 hours reading and practicing, I decided to start a rather larger project as a learning experience.
I've worked on the project for the last couple of days and it's now pretty close to complete, although there is some additional features I'd like to implement.

Allow me to introduce: the WoT Calculator!
The WoT Calculator got the following features:

1) Crew XP Calculator.
The Crew XP Calculator allows you to calculate the amount of XP needed to go from a certain training level and percentage to another. Do you want to calculate how much XP it takes to go from 50% on your major qualification to 100% on the 7th skill? No problem!
In addition to calculating the XP needed it will also apply modifiers such as accelerated training or mentor bonus if applicable. If you're currently training the mentor skill, it will calculate the exact XP saved per percentage until your mentor skill hits your targeted percentage or 100%, where after it will calculate any remaining XP with the full 10% bonus from mentor.
If you got mentor enabled, it will also put out different XP values for your Commander and Gunner/Driver/Radioman/Loader.
Finally it can calculate the total amount of battles needed to reach your targeted training level and percentage based on your average XP per battle.

2) Tank Stat Calculator.
The Tank Stat Calculator allows you to calculate the true value of a range of stats, depending on your major qualification percentage as well as any skills, perks, equipment and consumables if applicable.
Currently it can calculates the following stats: view range, aim time, accuracy, turret transverse, horsepower and horsepower/weight ratio, signal range and reload time/rounds per minute.

3) Armor thickness depending on angle.
Allows you to calculate armor thickness depending on angle.

I don't think any of these features are unique, but I've included them all in an easy and quick to use program. Just follow the instructions!

I'd love if any of you folks would give my program a go, and perhaps give me some feedback, especially if you spot any bugs!

How to use my program:
My program is contained in a .py file which Windows can't handle on it's own, so you will have to install Python 2.7.5 first. Python 2.7.5 all in all is about 16mb big, and include most of the stuff needed to write any kind of python program. Most importantly, it includes an interpreter which can run .py files.
The program is 100% free from any malware.

To download Python 2.7.5 you can either click this direct link www.python.org/ftp/python/2.7.5/python-2.7.5.msi or you can go to the following page and select the installer you want to use http://www.python.org/download/releases/2.7.5/.

To install, simply click on the installer and follow the instructions. It's easy!

Then you just need my file: mediafire.com download/1192i56ib0nxzkb/WoTCalculator.py
It's a small file with a size of 32 KB. Since I've hosted it on mediafire, you can view the content of the file before downloading it. Nothing suspicious in the code!

Now you just need to run my file. Two ways to do it:
1) If Python 2.7.5 is installed, simply double click my file and it will execute automatically.
2) Go to Start Menu -> All Programs -> Python 2.7 -> click on IDLE (Python GUI). In IDLE, press file -> open and then select my file. Now you have a window open where you can see my whole code. Press F5 to execute the code.

Downloading Python 2.7.5 and my code plus installing it shouldn't take more than a minute or two at most, so I hope there's someone out there who wants to go through the troubles to give my program a go.
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Mon Aug 19, 2013 5:00 am

I've just tried the crew XP calculator and I've encountered a bug when you type the avg XP in order to count how many battles you need to achieve a certain level. It just shows some lines in red and you can't do much afterwards

Anyways, pretty good, very handy, although a bit bare looking.

Also, when you try to go to armor thickness calc, after you press enter it asks you to select 1 or 2, but doesn't tell you which one does what. (1 is for armor calc, 2  is for main menu)
Maybe you can try to add effective armor thickness. Deducting 5 degrees from original angle for AP, 3 degrees for APCR and I think (not sure) that HEAT and HESH don't have normalization.

I got an error while trying to calculate commander's view range.
Spoiler:
Traceback (most recent call last):
 File "C:\Python27\WoTCalculator.py", line 972, in <module>
   selection()
 File "C:\Python27\WoTCalculator.py", line 52, in selection
   armorthickness()
 File "C:\Python27\WoTCalculator.py", line 965, in armorthickness
   selection()
 File "C:\Python27\WoTCalculator.py", line 52, in selection
   armorthickness()
 File "C:\Python27\WoTCalculator.py", line 941, in armorthickness
   selection()
 File "C:\Python27\WoTCalculator.py", line 50, in selection
   starttankstat()
 File "C:\Python27\WoTCalculator.py", line 474, in starttankstat
   commander()
 File "C:\Python27\WoTCalculator.py", line 493, in commander
   viewrange()
 File "C:\Python27\WoTCalculator.py", line 646, in viewrange
   progressivestat(baseviewrange,commanderskill,standviewrangebonus,viewrangeskillbonus)
UnboundLocalError: local variable 'standviewrangebonus' referenced before assignment

I hope this little bit of feedback helped, keep up the good work Smile 

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Mon Aug 19, 2013 6:12 am

Thanks for the feedback!

I've updated the file and I think I've gotten all the bugs you talked about, since I've corrected errors in all the areas you mentioned.
You can download the fixed code here.

I actually initially included normalization but got some wonky results when using low values. For instance, if you select an angle under 5 degrees, the armor thickness after ap normalization would be 0.08mm higher than without normalization.
I've put it back in with a quick fix.

I agree that it's quite bare looking. Do you have any suggestions on how to upgrade its looks? I've got limited tools since I'm not quite ready to start with GUI programming yet. I could add more boxes of #'s and such but I didn't want to overdo it as I thought it might be too intrusive.

Once again, thanks!
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Mon Aug 19, 2013 8:07 am

Niflhel wrote:

I agree that it's quite bare looking. Do you have any suggestions on how to upgrade its looks? I've got limited tools since I'm not quite ready to start with GUI programming yet. I could add more boxes of #'s and such but I didn't want to overdo it as I thought it might be too intrusive.

Once again, thanks!
Well, I don't know really. I guess you'll have to learn GUI programming to get this program really complete. I'm not sure if Python offers any GUI. Some more boxes here and there would help readability. I'll check the updated version tomorrow, too tired right now Razz 

About angles, you can always limit angle input to a minimum of 6 so it never goes to 0 or less when calculated.

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Mon Aug 19, 2013 9:31 pm

Vampir_Kifla wrote:
Niflhel wrote:

I agree that it's quite bare looking. Do you have any suggestions on how to upgrade its looks? I've got limited tools since I'm not quite ready to start with GUI programming yet. I could add more boxes of #'s and such but I didn't want to overdo it as I thought it might be too intrusive.

Once again, thanks!
Well, I don't know really. I guess you'll have to learn GUI programming to get this program really complete. I'm not sure if Python offers any GUI. Some more boxes here and there would help readability. I'll check the updated version tomorrow, too tired right now Razz 

About angles, you can always limit angle input to a minimum of 6 so it never goes to 0 or less when calculated.
Python does offer different kinds of GUI, but mostly it requires the user to download additional files to be able to run the program. So the question is if i should make a GUI to 'pretty' up the program, but making it less accessible, or stick with the current GUI.
A better GUI would definitely add something to this program, but I do not believe it's a necessity based on the functions of this program. What's important is the speed of which you can calculate something - and I'd say that pressing one followed by enter is about as fast as clicking a button in a window.

I've fixed the angles now, implemented the normalization wrongly yesterday - Now the program checks if the effective armor after normalization is of a lower than without normalization, and if it isn't, simply states that the normalization doesn't affect the armor at the given angle.

I'm currently implementing more boxes for readability, so you might want to wait with checking it out till that's done (should be today or tomorrow).
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Mon Aug 19, 2013 9:55 pm

GUI would be nice to pretty up the program, but I don't think it would cripple it's speed. And for average Joe, he's used to GUI with buttons, not just text window. I'm not sure whether you will release this program publicly or just keep it within SGTA. If it's the latter, I guess no GUI is needed. (at least for me)

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Mon Aug 19, 2013 10:53 pm

I didn't mean that a better GUI would slow down the program, but that it wouldn't add much in terms of the overall goal of the program: Getting quick results after you've decided to calculate something.

I've just created a function that prints boxes with lines of text to improve the readability of the program, and I'm about to implement it - While doing this, I'll restructure the program a bit so there's a lot less 'Press enter to continue' and instead it'll just print out all of your input before it starts the calculations, allowing you to go back and change something if you've input a wrong value.

Currently I don't have any intentions to release the program publicly, because I can't make it a standalone program (I'd have to distribute certain files which I don't have the rights to). Rather, I made this program for myself and thought some of the folks in this clan might find it useful.

Edit: Code is now updated. All text have been enclosed in boxes, and there's now less steps to finish the calculation. You might find a few places where the text doesn't form a perfect box, please let me know if you do.
Updated code
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Tue Aug 20, 2013 7:56 pm

A small update:
Fixed a few bugs
If your training level is 1 you can no longer enter a training level percentage below 50%
Whenever the program asks for input, it will now always say which range of numbers are valid

Updated code
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Thu Aug 22, 2013 10:53 pm

Ok, just tried the updated code and I got an error when going to crew XP calc and entering current crew training level.
Spoiler:
Traceback (most recent call last):
 File "C:\Python27\WoTCalculator.py", line 987, in <module>
   selection()
 File "C:\Python27\WoTCalculator.py", line 65, in selection
   starttraining()
 File "C:\Python27\WoTCalculator.py", line 160, in starttraining
   validintinput(minimum,'99','percentage')
 File "C:\Python27\WoTCalculator.py", line 13, in validintinput
   choice = int( raw_input('Enter your '+value+' ['+number1+'-'+number2+']: ') )
TypeError: cannot concatenate 'str' and 'int' objects

Actually, I get errors in every calculation...

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Fri Aug 23, 2013 12:10 am

Vampir_Kifla wrote:Ok, just tried the updated code and I got an error when going to crew XP calc and entering current crew training level.
Spoiler:
Traceback (most recent call last):
 File "C:\Python27\WoTCalculator.py", line 987, in <module>
   selection()
 File "C:\Python27\WoTCalculator.py", line 65, in selection
   starttraining()
 File "C:\Python27\WoTCalculator.py", line 160, in starttraining
   validintinput(minimum,'99','percentage')
 File "C:\Python27\WoTCalculator.py", line 13, in validintinput
   choice = int( raw_input('Enter your '+value+' ['+number1+'-'+number2+']: ') )
TypeError: cannot concatenate 'str' and 'int' objects

Actually, I get errors in every calculation...
Ah, I made a stupid mistake.Note to self: More testing before uploading! Should be fixed now.
Updated code
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Fri Aug 23, 2013 4:41 am

Armor thickness calculator not working Rolling Eyes 
Spoiler:
Traceback (most recent call last):
File "C:\Python27\WoTCalculator.py", line 998, in <module>
selection()
File "C:\Python27\WoTCalculator.py", line 69, in selection
armorthickness()
File "C:\Python27\WoTCalculator.py", line 968, in armorthickness
if eeapcr < ea:
NameError: global name 'eeapcr' is not defined

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Fri Aug 23, 2013 6:12 am

Vampir_Kifla wrote:Armor thickness calculator not working Rolling Eyes 
Spoiler:
Traceback (most recent call last):
 File "C:\Python27\WoTCalculator.py", line 998, in <module>
   selection()
 File "C:\Python27\WoTCalculator.py", line 69, in selection
   armorthickness()
 File "C:\Python27\WoTCalculator.py", line 968, in armorthickness
   if eeapcr < ea:
NameError: global name 'eeapcr' is not defined
Sorry for all the bugs Vampir_Kifla, but I changed so much code (~70%) and didn't have time to do a complete run through with all values. I've done so now, though, and have removed all the bugs I ran in to.
I haven't tried with different ranges of values, but I don't think there'd be any bugs with different values. Rest SHOULD be bug free now.
Updated code


Last edited by Niflhel on Fri Aug 23, 2013 6:49 am; edited 2 times in total
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Fri Aug 23, 2013 6:18 am

No worries mate, I totally understand you. After all, I'm studying programming aswell (although still a beginner) so I know how it is when you debug your program Wink

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Niflhel on Fri Aug 23, 2013 6:52 am

I'm glad you understand Very Happy 
I edited the previous post since I didn't notice you had posted (stupid me editing post before updating page!), but as I said, the program should be bug free now. Going through all possible paths doesn't produce any error codes. The only thing left now is a missing space here and there, as well as some text that doesn't fit the box.

Thanks A LOT for the help Vampir_Kifla, you've been a great help! What language are you learning, and have you made any interesting programs?
avatar
Niflhel

Posts : 30
Reputation : 5
Join date : 2013-07-01
Location : Denmark

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Vampir_Kifla on Fri Aug 23, 2013 9:26 am

Always there to help Wink

I'm learning C atm, will probably switch to C++. Haven't really been making any programs other than ones we have to make at university. I'm kinda looking forward to programming with GUI so it looks like a real program, not just text box Very Happy

_________________
avatar
Vampir_Kifla
INSTRUCTOR
INSTRUCTOR

Posts : 242
Reputation : 18
Join date : 2013-02-08
Age : 24
Location : Croatia

View user profile

Back to top Go down

Re: I've written a small program (WoT related!)

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum