Re: Moving away from BGT and learning python

2018-04-05 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Another term for it is namespace, any variables declared in a function stay in a function, unless explicitly returned to the caller to prevent conflicts with other variables outside the given space. Other than using globals, what you can also do is set it up so X is filled with a returned value the function gives back that updates it with a new value, for example:def my_fun(a):
a = a + 1
x = a
print(a)
print(x)
return x

x = 3
x = my_fun(x)
print xKeep in mind that if you use a return call in a function, the function will end and anything beyond the return call will be ignored, so be sure to put it at the end or in places where you want the function to end.

URL: http://forum.audiogames.net/viewtopic.php?pid=358431#p358431




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Moving away from BGT and learning python

2018-04-05 Thread AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector


  


Re: Moving away from BGT and learning python

In Python, when you run the "my_fun" function, the variables are createdinside the function.When the function returns or when it ends, Python removes thevariables that are inside the function and restores thevariables that are declared outside it.This is called a namescope (the function has a namescope which theirvariables are declared, and the script has another).When you tipe x in the interpreter, you are referencing the x of thescript namescope because the function has already ended.Edit: to modify a variable inside a function, declare it as global so itcan be seen on the script namescope. See the example:>>> def set_x_and_print_it():...     global x...     x = 3...     print(x)...>>> set_x_and_print_it()3>>> x3

URL: http://forum.audiogames.net/viewtopic.php?pid=358426#p358426




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Moving away from BGT and learning python

2018-04-05 Thread AudioGames . net Forum — Developers room : thggamer via Audiogames-reflector


  


Re: Moving away from BGT and learning python

In Python, when you run the "my_fun" function, the variables are createdinside the function.When the function returns or when it ends, Python removes thevariables that are inside the function and restores thevariables that are declared outside it.This is called a namescope (the function has a namescope which theirvariables are declared, and the script has another).When you tipe x in the interpreter, you are referencing the x of thescript namescope because the function has already ended.

URL: http://forum.audiogames.net/viewtopic.php?pid=358426#p358426




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Moving away from BGT and learning python

2018-04-05 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so, consider the following code: Note: indentation is a greater than sign:def my_fun(a):>a = a + 1>x = a>print(a)>print(x)x = 3my_fun(x)So I now have a question. If you run this, you will be printed a value of 4 4. Now, here's the fun part. If you type in x in the interpreter it will say, clearly, 3, but wait. I had a statement in the my_fun function that should have set x to 4, so why is it 3? Ferther more, if you type in a, the following will appear:Traceback (most recent call last):                                                File "", line 1, in                                            NameError: name 'a' is not defined                                              but but but... I clearly set a to 4! So why, why in the world does the stupid thing reset and acts as though I have never defined a variable called a? After all, I did do it. So my question is how? How can I change the variable outside of a function instead of declaring a variable that lasts only till a function finishes running? Is it something to do with the return statement? I'd be really grateful for any help and would also appreciate if you provided a code snippid or some such.

URL: http://forum.audiogames.net/viewtopic.php?pid=358424#p358424




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

or you can run it from the CMD open the command prompt in the path in which your file is, and run python filename.pypost 42:This may not work, but you can try thisimport turtleI'll use the greater sighn for indentationwn = turtle.screenwhile 1:>title=str(input("enter the screen title"))>wn.title(title)>breakif the script should keep asking you the title, remove the break statement.REGARDS

URL: http://forum.audiogames.net/viewtopic.php?pid=353976#p353976





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: Moving away from BGT and learning python

No. Anywhere will do.

URL: http://forum.audiogames.net/viewtopic.php?pid=353967#p353967





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Does the file have to be in a certain location?

URL: http://forum.audiogames.net/viewtopic.php?pid=353960#p353960





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

From the Python interpreter, you import it. If the file is HelloWorld.py, you would type>import HelloWorldAnd that would do it. I'm not sure that there's an easy way to repeat this without restarting the interpreter, though, if you make changes afterward.

URL: http://forum.audiogames.net/viewtopic.php?pid=353946#p353946





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Assuming your using IDLE that comes with python, the default configuration opens the python shell interpreter. If you open the File menu and select New File it will create a script window where you can write, save, load, and run scripts more directly, such as opening the Run menu and selecting Run Module. You can reconfigure IDLE to load with the script window by default instead of the shell in the Options menu under the General tab.

URL: http://forum.audiogames.net/viewtopic.php?pid=353945#p353945





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

This might be a bit silly, but how do you run a file from an interpreter? Do you just paste in the file path?

URL: http://forum.audiogames.net/viewtopic.php?pid=353933#p353933





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Try saving it to a file, and run that. If the results are the same, something odd is happening (maybe spaces are showing up as the wrong character or something like that?). If it works from a file, then the interpreter is having trouble with pasting some things.

URL: http://forum.audiogames.net/viewtopic.php?pid=353926#p353926





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-26 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I am using a book called how to think like a computer scientist found at the following linkhttp://openbookproject.net/thinkcs/python/english3e/If you go to chapter 3, you'll see that the book suggests you to enhance the turtle program by allowing the user to set the title of the window and such. Trouble is, the input statement doesn't work. I'll post the code below, or at least the important part. import turtlewn = turtle.Screentitle = input("enter something")wn.title(title)If I run this, it would make the title thewn.title(title)Line instead of asking for input. I tried getting input before initializing the screen but, no luck.

URL: http://forum.audiogames.net/viewtopic.php?pid=353923#p353923





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

alright: more problems. Yea! Who loves problems?When I pasted in the following, the python prompt returned me a big fat nothing.I will post the code below, using > again to represent a single space.>user_input = input("enter something")>if user_input == "hi":>>print("hello") #this causes an error with the indentationThat script does nothing at all besides the error.It also should be noted that I have tried something like this:>user_input = input("enter something.")>if user_input == "hi":>print("hello") #the script returns another error about the indentation.Finally, I have tried something like this:>user_input = input("enter something")>if user_input == "hi":print("hello") #this is the only part that works. The input and the if statement get skipped.

URL: http://forum.audiogames.net/viewtopic.php?pid=353775#p353775





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

alright: more problems. Yea! Who loves problems?When I pasted in the following, the python prompt returned me a big fat nothing.I will post the code below, using > again to represent a single space.>user_input = input("enter something")>if user_input == "hi":>>print("hello")That script does nothing at all.It also should be noted that I have tried something like this:>user_input = input("enter something.")>if user_input == "hi":>print("hello") #this script doesn't do anything besides just sitting there. the python returns nothing.

URL: http://forum.audiogames.net/viewtopic.php?pid=353775#p353775





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

alright: more problems. Yea! Who loves problems?so when I paste in the script it says invalid indentation on line that says print("hello"). I will post the code below, using > again to represent a single space.>user_input = input("enter something")>if user_input == "hi":>>print("hello") #this line causes an error with the indentation.It also should be noted that I have tried something like this:>user_input = input("enter something.")>if user_input == "hi":>print("hello") #this script doesn't do anything besides just sitting there. the python returns nothing.

URL: http://forum.audiogames.net/viewtopic.php?pid=353775#p353775





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

you are missing the colons after the condition iftry putting this>user_input = input("enter something")>if user_input == "hi":>>print("hello")

URL: http://forum.audiogames.net/viewtopic.php?pid=353767#p353767





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so this is what i'm trying to paste into my python prompt. I think if someone can point out what am I doing wrong it would clear it up for me: (Note, I'll use a > symbol to represent a single space as AG forum doesn't like python's indentation.)>user_input = input("enter something")>if user_input == "hi">>print("hello")I'm sorry for so many questions guys, I'm trying to understand this.

URL: http://forum.audiogames.net/viewtopic.php?pid=353766#p353766





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so this is what i'm trying to paste into my python prompt. I think if someone can point out what am I doing wrong it would clear it up for me: user_input = input("enter something") if user_input == "hi"  print("hello")I'm sorry for so many questions guys, I'm trying to understand this.

URL: http://forum.audiogames.net/viewtopic.php?pid=353766#p353766





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-25 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

for example you do thisthink this is the interpreter>>> input = raw_input("enter something")>>> if input == 'hi':...  print "hello"... this means after you write the code you'll have to press enter one more time and the interpreter will execute your code.note: I'm using indentations with 1 space only

URL: http://forum.audiogames.net/viewtopic.php?pid=353709#p353709





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

You need to press enter so that Python knows you're done with the indented part.

URL: http://forum.audiogames.net/viewtopic.php?pid=353683#p353683





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I'm not sure I understand? When do I paste in a blank line?  If you're talking  about me having code after the if statement, yes, I do.

URL: http://forum.audiogames.net/viewtopic.php?pid=353681#p353681





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Another way to do it would be to save your script in notepad or similar text editor and run it from a command prompt, as python files are just plain text files with a renamed extension. For example: "python yourscript.txt", though to avoid confusion between file types you should probably save your scripts with a *.py extension instead of *.txt.

URL: http://forum.audiogames.net/viewtopic.php?pid=353676#p353676





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Another way to do it would be to save your script in notepad or similar text editor with a *.py extension and run it from a command prompt, as python files are just text files with a renamed extension. For example: "python yourscript.py".

URL: http://forum.audiogames.net/viewtopic.php?pid=353676#p353676





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

When you start something like an if, while, class, or function, Python expects an indented block to follow. The editor therefore waits until you enter an unindented line, or leave a blank line, before it tries to execute the code.If you're pasting an if with a block attached, I'm not really sure what's going on.

URL: http://forum.audiogames.net/viewtopic.php?pid=353672#p353672





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so now I'm getting into if statements, and just pasting the contense of the file doesn't work. I want to get input from the user then use if statements to print out different messages depending on what was entered, however, when I paste it into the python prompt it just sits there. no errors, no anything. what am I missing here?

URL: http://forum.audiogames.net/viewtopic.php?pid=353670#p353670





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I usually just save to a file with notepad, then run it in python by importing . IIRC, this doesn't work so well if you want to test changes, since I don't think python will update the module if you try to import it again, unless it failed to import via an error or something. Could have that backward, though.

URL: http://forum.audiogames.net/viewtopic.php?pid=353667#p353667





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

you can do by pressing alt plus space, edit, paste

URL: http://forum.audiogames.net/viewtopic.php?pid=353658#p353658





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I have a slight issue. when ever trying to type a script in a notepad and pasting it into the python the ctrl v doesn't work. anyway I can paste?

URL: http://forum.audiogames.net/viewtopic.php?pid=353650#p353650





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Let me add something:I personally prefere to enclose strings in quotes, unless I have the following situation, for example, if I wanna have a message box that displays the user to click a button. I want the name of that button to be quoted, so I will enclose this in apostrophes like this:'Please click "OK" to continue'That way, I don't need to escape quotes to force displaying them inside a string by using escape sequence \" (backslash quote).

URL: http://forum.audiogames.net/viewtopic.php?pid=353640#p353640





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector


  


Re: Moving away from BGT and learning python

You basically use triple quotes or triple ticks when you want to write multiline strings. This does not mean that string needs to be necessarily multiline, but writing single-line strings in tripple quotes makes no sense, although it's not an error.Of course, instead of using multiline strings, you can just use escape sequences such as \n or \r, but it makes things less readable for code writer. For example:"I'm a good boy.\nI'm the best guy in school.\nMy friends really like me."Compare with this:"""I'm a good boy.I'm the best guy in school.My friends really like me."""You see, the second version as multiline string is much more readable.

URL: http://forum.audiogames.net/viewtopic.php?pid=353637#p353637





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so one of my first many questions to come.when creating strings, why cant I just use tripple quotes or ticks all the time? is there a disadvantige in doing so?

URL: http://forum.audiogames.net/viewtopic.php?pid=353618#p353618





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-20 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: Moving away from BGT and learning python

True. What makes .NET so nice is that you can mix managed and unmanaged code. Also, about pointers, pointers in C++ are not as scary as some people make them out to be. In fact, they're very easy to work with. You usually never have to do manual pointer cleanup because C++ usually handles that for you either upon program exit or upon scope exit. And with C++11, 14 and 17's new STL components, you now have std::smart_ptr and std::shared_ptr to use too, which both free themselves when no longer used.

URL: http://forum.audiogames.net/viewtopic.php?pid=353153#p353153





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-20 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

There still are pointers in c++. While it is encouraged to pass things as reference or const reference, pointers are still okay to use and perfectly acceptable in the language.

URL: http://forum.audiogames.net/viewtopic.php?pid=353106#p353106





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-20 Thread AudioGames . net Forum — Developers room : gjp1311 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Personally I'm very found of C# and the whole .NET environment. The language has the same learning curve as Java, though I think the ecosystem in .NET is easier to get around.With this language you are able to use lambdas and functional programming concepts that Python has, without any trouble. And for what I'm seeing, this BGT seems like C and C++. I think the advantage of working with C# (And Java for that matter) is using managed code.You won't be needing to worry about memory and pointers too much. You don't have pointers as in c and c++, but objects are references. It's easier for sure, but can be tricky sometimes.I learned a bit of Python, but as I have worked my entire life with C-like languages, I found it very annoying to have to structure the code using only tabs and spaces. But I like very much the functional aspect of the language.And as a plus, Visual Studio Community is very accessible.https://www.reddit.com/r/programming/co … o_2017_to/https://youtu.be/iWXebEeGwn0

URL: http://forum.audiogames.net/viewtopic.php?pid=353050#p353050





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-20 Thread AudioGames . net Forum — Developers room : gjp1311 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Personally I'm very found of C# and the whole .NET environment. The language has the same learning curve as Java, though I think the ecosystem in .NET is easier to get around.With this language you are able to use lambdas and functional programming concepts that Python has, without any trouble. And for what I'm seeing, this BGT seems like C and C++. I think the advantage of working with C# (And Java for that matter) is using managed code.You won't be needing to worry about memory and pointers too much. You don't have pointers as in c and c++, but objects are references. It's easier for sure, but can be tricky sometimes.I learned a bit of Python, but as I have worked my entire life with C-like languages, I found it very annoying to have to structure the code using only tabs and spaces. But I like very much the functional aspect of the language.And as a plus, Visual Studio Community is very accessible.https://www.reddit.com/r/programming/co … o_2017_to/

URL: http://forum.audiogames.net/viewtopic.php?pid=353050#p353050





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-20 Thread AudioGames . net Forum — Developers room : gjp1311 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Personally I'm very found of C# and the whole .NET environment. The language has the same learning curve as Java, though I think the ecosystem in .NET is easier to get around.With this language you are able to use lambdas and functional programming concepts that Python has, without any trouble. And for what I'm seeing, this BGT seems like C and C++. I think the advantage of working with C# (And Java for that matter) is using managed code.You won't be needing to worry about memory and pointers too much. You don't have pointers as in c and c++, but objects are references. It's easier for sure, but can be tricky sometimes.I learned a bit of Python, but as I have worked my entire life with C-like languages, I found it very annoying to have to structure the code using only tabs and spaces. But I like very much the functional aspect of the language.

URL: http://forum.audiogames.net/viewtopic.php?pid=353050#p353050





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-19 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

You can get an equivalent to NPEs in Python, can't you? I mean, doesn't the exact same principal apply to trying to call a.f() if a is null or if a is None?Basically, you can't expect that a function or method will never be called with invalid arguments, so the very first thing you should do is to confirm that the arguments are valid. A simple "if a is None : return False", or whatever the appropriate default is, or throwing an error, works well enough in most cases I encounter Is it a style thing? Java has ludicrous style conventions, like making absolutely everything into classes, making new classes for extremely specific exceptions, overly verbose class names, package conventions that amount to a lot of wasted space... But those are just style conventions, and unless you're working with a package that has already gone too far down that rabit hole to be salvageable, you can basically treat Java like most C-style languages, just without a global context, right?I basically gave up on Java when BGT and Python proved all around better for my purposes, so if some updates in the past 5 or so years have enforced the tedious clutter, then I missed it.

URL: http://forum.audiogames.net/viewtopic.php?pid=353012#p353012





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-19 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: Moving away from BGT and learning python

@Hrvoje, most of the issues you pointed out, like null pointer exceptions, can be gotten around easily. For example, in C++, you'd either use a library that *doesn't* use NULL or nullptr, or you'd do checks for them.

URL: http://forum.audiogames.net/viewtopic.php?pid=353010#p353010





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-19 Thread AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Well, honestly. Python's indentation is may be the only thing that may frustrate beginner users. However, Python is a piece of heaven comparing to some other languages where you get frustrated with null pointer exceptions, data conversions, not to mention that it's quite easy to forget to enclose braces when you have lots of nested blocks. I'm using Java at work, and I've realised how I miss Python, although I'm still using it for writing NVDA addons and some other private stuff. Python is far from perfect, because nothing in this world is perfect, but Python is very popular and saves your time a lot, at least from my experience. For me it's more important to get things done as soon as possible, than spending weeks of work on something that I can get in a single day. Life is too short for that.

URL: http://forum.audiogames.net/viewtopic.php?pid=352973#p352973





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I'm currently writing a large application and have written everything in notepad. I haven't used an IDE at all, unless you count the VC++ command-line developer tools as an 'IDE'. Also, the smart string concatenation that people are referring to is either of the following, if I'm following your wavelengths:1. Printf-style formatting, i.e.:printf ("%s %.3f\n", "Pi is equal to", 3.14159); // prints pi is equal to 3.141.2. Boost.format-style syntax:#include #include std::string s2 = boost::str(boost::format::format("%2% %1%") % 36 % 77 );(Taken from http://www.boost.org/doc/libs/1_66_0/li … rmat.html; lots more examples there.)(I admit, this method is a bit more clunky.)There is, of course, the optional third way of doing things:3. IOStreams-style formatting (setf/setw). Example at http://en.cppreference.com/w/cpp/io/ios_base/setfThere are probably a lot more ways of string concatenation. One other way is through stringstreams:#include using namespace std;stringstream ss;ss << data;ss << data << data << ...;// Repeat until you've got all your data in the stringstream Or you can make a set of <// ss << data << data << ... << data;// Get final stringstring data = "">

URL: http://forum.audiogames.net/viewtopic.php?pid=352843#p352843





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Yeah. I find that, while IDEs reduce some of the work, they make up for it with clutter and navigation and gah just let me write the code in a text editor, read the compilation results, and test the thing. Notepad + the command prompt is generally sufficient, but Python.exe launches a useful terminal, also.

URL: http://forum.audiogames.net/viewtopic.php?pid=352834#p352834





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Guitarman via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Hi Amerikranian.Goodness, I am tired of hearing stupid stuff like this! Yes you can use notepad to write python programs no problem. I've seen this in many python tutorials, "Don't use notepad, it's very bad!" If it's easier for you to use notepad then go ahead. You can still run scripts with the command prompt if you really want to later. Just keep in mind that the books are wrong about things sometimes.Hth.

URL: http://forum.audiogames.net/viewtopic.php?pid=352811#p352811





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Jaseoffire via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Yeah, I was mainly talking about the conditional stuff like switch case statements and the ternary operator. Python's constant if/elif/else blocks feel repetative to type. In C/C++ (Which admittedly is beginning to put this language back in my good graces over Java) is the preprocessor which allows for macros and that sort of thing. Plus, more as a personal preference, I prefer the braces to the forced tabbing system. In C/C++/Java, if I forget a tab somewhere, the compiler and or program is not going to yell at me about it. Not to say anyone that I might be working with on a project won't mind you, but I'd rather have them angry at me when it would be a simple correction requiring little trouble of retesting stuff. I can write the program as I wish and if it works, I know it isn't a blocking issue because I forgot a tab somewhere. If it's a nice enough IDE, a lot of the brace stuff is handled for me as well. Celebrating your existence, Eclipse.

URL: http://forum.audiogames.net/viewtopic.php?pid=352800#p352800





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Jaseoffire via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Yeah, I was mainly talking about the conditional stuff like switch case statements and the ternary operator. Python's constant if/elif/else blocks feel repetative to type. In C/C++ (Which admittedly is beginning to put this language back in my good graces over Java) is the preprocessor which allows for macros and that sort of thing. Plus, more as a personal preference, I prefer the braces to the forced tabbing system. In C/C++/Java, if I forget a tab somewhere, the compiler and or program is not going to yell at me about it.

URL: http://forum.audiogames.net/viewtopic.php?pid=352800#p352800





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Moving away from BGT and learning python

so the book says not to use notepad. Is there any other edetors that you'd suggest? I don't want to go try a random one in case of it not being accessible.

URL: http://forum.audiogames.net/viewtopic.php?pid=352787#p352787





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Amit via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Hi,Actually the %s thing is still valid in python 3 as I just checked it out. IF you don't want to use it then you can use the power feature introduced in python, called f strings or formated strings. like this: name="amit"print(f"hi {name{!")As you can see this is much more simpler than that %S or other methods to do this.Regards,Amit

URL: http://forum.audiogames.net/viewtopic.php?pid=352770#p352770





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : Orin via Audiogames-reflector


  


Re: Moving away from BGT and learning python

What's the V3 way of doing things?

URL: http://forum.audiogames.net/viewtopic.php?pid=352764#p352764





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

oh I see

URL: http://forum.audiogames.net/viewtopic.php?pid=352734#p352734





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : ironcross32 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

that %s stuff is the old way of doing things, you don't do that in python 3

URL: http://forum.audiogames.net/viewtopic.php?pid=352727#p352727





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-18 Thread AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector


  


Re: Moving away from BGT and learning python

@post 10:smart string concatenation? I think this is pretty smart name = "paul"surname = "iyobo"print "hi %s, %s" % (name, surname)or maybe I totally missunderstood what you were saying

URL: http://forum.audiogames.net/viewtopic.php?pid=352710#p352710





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Moving away from BGT and learning python

a= (b) ? c : d; switch (e) {case f : g(); break;case h : i(); break;}And then there are c-style macros.Python is supremely simpler overall, but I do need the terniary operation far more often than swapping.Yeah, Python eventually added its own version (which is annoying to port, since it puts the arguments in a different order), but it's not as quick as a=(b)?c:d; But that's all I can think of that python does less conveniently. ... Well, that and the lack of smart string concatenation.

URL: http://forum.audiogames.net/viewtopic.php?pid=352692#p352692





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : Amit via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Hi,At post number 7,, excuse me please, but what kind of c/c++ syntax are you talking about? I know some c++ and what I've always seen that a c++ programmer is always bigger compared to a python program. And python is so simple too. To support this, look some python below.a=5b=10a,b=b,awhat the above code did is that it swapped the values those two variables, a and b contained. Imagine doing this in c/c++ or BGT. To do this you will need a third variable.Regards,Amit

URL: http://forum.audiogames.net/viewtopic.php?pid=352689#p352689





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : Guitarman via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Hi.Both python 2 and 3 both have pip now, you just need to edit the systems variables. Pip won't respond in command prompt unless you do this. Python's syntax is very simple, especially for making small utilities and things like that.You should take a look at the documentation, then read something like dive into python or one of those.Hth.

URL: http://forum.audiogames.net/viewtopic.php?pid=352664#p352664





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : Jaseoffire via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Oh. Thank goodness. I'm getting really tired of BGT and my antivirus having a civil war on my computer, so hopefully seeing more developers migrating away from it might solve most of those issues. Probably not all of them because antivirus software is...well...odd, but still. I'd also add don't neglect the documentation on the website, and poking around Stack Overflow and google. While python is not my favorite language as it lacks several of the nice time saving syntax found in C family languages, I won't deny that it is not too difficult to learn.

URL: http://forum.audiogames.net/viewtopic.php?pid=352658#p352658





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector


  


Re: Moving away from BGT and learning python

make sure pip is in your path, and if its not, add it.go to the run dialog, type SystemPropertiesAdvanced, click environment variables, tab down to the system variables list, find path, click edit.Go to the end of this text. Now you'll have to add the path of pip, assuming your using py3 this is c:\Python36\scripts\pip.exenote: ; (semicolon) is used as the delimiter here, so the end should look like c:\some\random\thing;c:\Python36\scripts\pip.exeHTH

URL: http://forum.audiogames.net/viewtopic.php?pid=352615#p352615





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : Amit via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Hi,Open command prompt by typing cmd in the run dialogue box and pressing enter. Now type pip install pygame pyinstaller libaudioverse. That was an example... This way you can install your libraries automatically. If this is not working, use the cd command to navigate to the scripts folder of where your python is installed (for example, cd c:\python36\scripts) and run the pip command as shown above.Regards,Amit

URL: http://forum.audiogames.net/viewtopic.php?pid=352601#p352601





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-17 Thread AudioGames . net Forum — Developers room : blink_wizard via Audiogames-reflector


  


Re: Moving away from BGT and learning python

I'm confused on that. I tryed entiring the pip command but nothing happens. Where do I type this? Very confused on where this goes...

URL: http://forum.audiogames.net/viewtopic.php?pid=352599#p352599





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-16 Thread AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Python is a good choice because it's syntax is even easier than BGT. Everything is an object and everything is dynamic, so it's not required to declare data types.When I've started learning Python, which was somewhere in late 2009., I found a book called "A byte of Python". That introduced me to the Python world. Later on if you wish to expand your Python knowledge, read the book called "Dive into Python".My suggestion is go with Python 3, it's the future. Python2 has unicode issues that I faced many times while developing software with Python, and you will sooner or later have to deal with these issues. Python3 is unicode by default, which is something to expect from a programming language nowadays, since almost nobody now is using Windows 9X or ME where ANSI was a standard.You can use wxPython for making GUIs. Sighted developers on the Internet constantly recommend PyQT saying that it's the best, and may be it really is, however it has accessibility issues. BTW, I don't like to use the term The Best too much, .For communicating with screen readers, you have two options, the one is called Tolk and another one is called Accessible Output. However, the repository where accessible output is hosted seams to be currently down, so Tolk is the only good option right now. I'm combining Tolk with Pyttsx3, which is another python library for SAPI support.For 3D audio, you can use libaudioverse. For making games you have Pygame or Pyglet as a choice.For networking, you can use Twisted.And, for converting your Python script into executable, you have Py2Exe, CXFreeze or PyInstaller. I like PyInstaller, because generating exe is simple as writing pyinstaller with additional commandline options. I was using Py2Exe before, but it wasn't updated since 2014.And, most of Python libraries can be easily installed, updated or removed by using pip on command line e.g., pip install wxpython, pip install libaudioverse, pip install pygame, pip install pyinstaller.

URL: http://forum.audiogames.net/viewtopic.php?pid=352572#p352572





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Moving away from BGT and learning python

2018-02-16 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Moving away from BGT and learning python

Well the first step would be to download Python [here]. Some good books to start off with would be [A Byte of Python] and [How to Think Like a Computer Scientist], although you can find a bunch more [here].

URL: http://forum.audiogames.net/viewtopic.php?pid=352568#p352568





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Moving away from BGT and learning python

2018-02-16 Thread AudioGames . net Forum — Developers room : blink_wizard via Audiogames-reflector


  


Moving away from BGT and learning python

Hi there,so very recently I decided to just finally move on and try something new. I want to do other things besides games etc, and I need to learn a better programming language than BGT. So...from a bgt user, what are some tips or resources to learn python. BGT is so simple that its hard to move away from, but it needs to be done. It is clear that it's done and it probably won't ever be updated again.

URL: http://forum.audiogames.net/viewtopic.php?pid=352554#p352554





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-26 Thread AudioGames . net Forum — Developers room : Guitarman via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Hi.Sorry about that frastlin's post reminded 'me panda 3d is the one I was trying to think of. Libaudioverse handles 3d sound very well I've used it a couple of times and liked it a lot. It isn't finished yet so who knows what sort of features will be added in the future. Pyaudio game is good it's manual is very helpful and it will show you how to make audiogames it focuses on audiogame development spacifically.@Cae, accessible output 2 has support for all desktop screen readers. Nvda, jaws, system access, sapi, WindowEyes, voiceover on mac and orca on linux. Right now there is no support for touch screen screen readers but I'm hoping that will be added in the future. I'm also unsure if accessible output 2 can be used if your not a python developer since there python files and I'm not exactly sure what would happen if you compiled them to use with another language. Maybe I'll try that tomorrow and see if python has a fit lol
 .Hth.

URL: http://forum.audiogames.net/viewtopic.php?pid=232943#p232943




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-26 Thread AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

get libaudioverse fromhere get the docs for it from here Note: these files are unofficial. Camlorn hasn't set up a wheel-building thing yet. This is the latest github-built version.

URL: http://forum.audiogames.net/viewtopic.php?pid=232950#p232950




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-26 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

if you are looking for cross language support for screen reader output look at tolk. its only windows. but if your going to only use python accessible_output2 would be better anyway. AO2 does have cross platform support for screen readers on mac and linux. i really don't have a lot to add here apart from everything everyone else already said.

URL: http://forum.audiogames.net/viewtopic.php?pid=232980#p232980




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Use Learn Python the Hard Way to learn python.Libaudioverse is the best sound library, but it's not quite done yet.FMod is also good and panda3d supports fmod right out of the box.PyQt is the best library for cross-platform development.

URL: http://forum.audiogames.net/viewtopic.php?pid=232940#p232940




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Pygame, Pyglet, Pyo... I only got anywhere with the first, but they all come up for games and sound. (And whenever Libaudioverse gets release-ready, it will already support Python.)I don't know if accessible_output2 is cross-platform or not. It works fine for me (Python 2.7 on Windows 8.1).I tried to port the BGT sound_pool to work with Pygame. It's not an optimal solution, but the idea was to avoid needing to dive into something radically different (which usually means more complicated) and to also open up the possibility of easily porting my BGT games to Python (  I think that would want some kinda sutomated translator). If you need it, I can upload it.

URL: http://forum.audiogames.net/viewtopic.php?pid=232931#p232931




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Pyglet's already been mentioned which supports OpenAL, it also handles windowing, mouse, and keyboard input. PyAL is a module for just OpenAL, along with Pyttsx which handles speech synthesis using system sounds.

URL: http://forum.audiogames.net/viewtopic.php?pid=232936#p232936




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : themadviolinist via Audiogames-reflector


  


Going to get serious about learning Python, need some tips

Ok, I'm in the Windows 10 world for now and have decided that I wish to learn to make Windows applications in Python as part of a larger project to eventually move cross-platform.  What are the best tools for Python development from an access standpoint?  What would folk recommend as the best resources for learning the language?  If I'm interested in game development, what resources would be best for working with sound?

URL: http://forum.audiogames.net/viewtopic.php?pid=232919#p232919




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : Guitarman via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Hello Themadviolinist.Sorry I could never figure out how to post links but I'll tell all about python. First get python 2.7 from python.org don't use python 3 it's syntax is a little and I think it would get a little confusing for a beginner like yourself.I would start out by reading the python documentation it's not great but it will tell you what you need to know. Also read learn python the hard way, there is a version you can buy but the free version is just as good read it and do all the exercises. Read this with the python documentation read together you will learn a lot. Do all the exercises even if they seem to easy for you there good practice.I wouldn't worry about soud libraries right now but there are a few pysonic and there's another one pylama or something like that it's slipped my mind.I would start out making guess the number and small text games. Guess the number is simple enough using random.rand.int and ra
 w_input.If you have any other questions just ask but like I said the python documentation and learn python the hard way should answer most of your questions.Hth.

URL: http://forum.audiogames.net/viewtopic.php?pid=232925#p232925




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Going to get serious about learning Python, need some tips

2015-09-25 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Going to get serious about learning Python, need some tips

Pygame, Piglet, Pyo... I only got anywhere with the first, but they all come up for games and sound. (And whenever Libaudioverse gets release-ready, it will already support Python.)I don't know if accessible_output2 is cross-platform or not. It works fine for me (Python 2.7 on Windows 8.1).I tried to port the BGT sound_pool to work with Pygame. It's not an optimal solution, but the idea was to avoid needing to dive into something radically different (which usually means more complicated) and to also open up the possibility of easily porting my BGT games to Python (  I think that would want some kinda sutomated translator). If you need it, I can upload it.

URL: http://forum.audiogames.net/viewtopic.php?pid=232931#p232931




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-07 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Thank you so much for all of the help.

URL: http://forum.audiogames.net/viewtopic.php?pid=231107#p231107




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-06 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Thanks, that clears up a lot for me. I had another question though, when naming variables or functions I see that most people seem to use underlines, I heard that you can also use another method where you capitalize the first letter of each word. Is there any particular standard or reason why most people use underlines? I kind of prefer using capitals because it is less confusing when Jaws reads a line of code.

URL: http://forum.audiogames.net/viewtopic.php?pid=230676#p230676




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-06 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Learning Python

Hello,I tend to write my main function at the bottom of the module just because it allows me to easily jump from the bottom line where I execute the main function to the main function. There is no need to declare a function in any order as long as you are running the function at the bottom of the module. For example:def function1():  print("Hello")def function22():  function1()  function3()def function3():  print(" world")function2()I write using python 2 syntax. There are some tendencies that one can do that make python 2 and 3 compatible and this is what I try to do when ever I can. For example:print("Hello world")could also be written as:print "Hello world"but why do it like that? It is unclear and not compatible. print("Hello world") works on both 2.7 and 3.* and it tells us that print is a function... T
 here are also some more advantages to treating print as a function. There are keyword arguments that one can use in print the function and not print the statement as well.The only real difference is the input vs raw_input function. Other than that python 2 and python 3 are the same to newbies.If you follow python3 for imports:from .mymodule import myfunctionit works in both 2 and 3.

URL: http://forum.audiogames.net/viewtopic.php?pid=230675#p230675




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-06 Thread AudioGames . net Forum — Developers room : Alan via Audiogames-reflector


  


Re: Learning Python

@TJ.BreitenfeldtIt's important to take some previous notes about how your program will work once finished before starting. If you don't, you will rewrite and rewrite code again. Example:1. There will be a main menu.2. THis menu will contain elements.3. You can select each element and then something happens.It could feel ridiculous, but if you didn't,... Example:Oh, I have 4 different kinds of menus, each has its own features, but now I'd like to log all the activity, so... let's code our menus again.Wait, I have implemented the logging feature, but now each menu element returns a string that is added to the log, and I'd like to make my program easy translatable, so I need that each element returns an integer that then is converted to a string according to the choosen language... Let's rewrite all again! Etc.There are a lot of ways to organize your code, depending on your needs. A basic understanding of some of the most common design paterns would help you too. Take a look at the infamous Gang of Four book (GoF), or google for gang of four paterns:http://www.gofpatterns.com/design-patte … nefits.phpBasically, a patern is an organization model for your code that works with any programing language. For example, the observer paterns (also known as event driven patern) implements a messaging sistem whitch allows you objects, functions or whatever, sending messages to other members, such like: hey there! I'm X and someone has just killed me. Or: hey, server, an user instance has send a message to chatroom X... But it's being a boring and long post, time to leave.Hope this helps.

URL: http://forum.audiogames.net/viewtopic.php?pid=230682#p230682




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-06 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Learning Python

Pep 8 is the bible of python style:https://www.python.org/dev/peps/pep-0008/Look at the heading:Method Names and Instance Variables Learn Python the Hard Way will have you go through this a couple times, so read it every few months. It is a really good idea to follow it in any code you right.C++ and _javascript_ have nothing like this and their code looks really really really messy to someone coming from python. I love python because of pep 8. That way you can tell what is what just by reading its name.

URL: http://forum.audiogames.net/viewtopic.php?pid=230698#p230698




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-04 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

When writing code like what frastlin posted above using so many functions, it seems that you have to work backwards starting near the end of the code and writing upwards. Is this the case, or do most people just learn to plan out the program completely first, and have the ability to think backwards.

URL: http://forum.audiogames.net/viewtopic.php?pid=230645#p230645




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Thanks guys this helped a lot. I have not gotten to using classses yet, but I do see how that would work. I forgot about the return statement to return a value and then use it else where in the program. I was not intending to create a variable called True, I just wanted a simple generic way of creating a endless loop that I could terminate with conditionals. I thought that you could define the Boolean value True and set it equal to the Boolean value of True to get the endless loop. I don't think I actually created a variable there, I believe both values of True are Boolean values.

URL: http://forum.audiogames.net/viewtopic.php?pid=230431#p230431




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

I understand. Thank you. I had another question though, I tried to do what Alan recommended by creating the function and returning the value, but I can't seem to get it to work. The error I am getting is that "dice" (my list of die in the function) is undefined. Can someone help me again. Here is my code.from random import randrangescore1 = 0;score2 = 0turn = 0;def DiceList():    dice = [randrange(1, 7), randrange(1, 7)];    return dice;while turn >= 0:    DiceList();    print ("Press enter to roll...");    roll = input();    while roll == "":        print ("You rolled:");        for i in dice:            print (i);        turn += 1;        break;    if (turn % 2 == 0):        score2 = score2 + dice[0] + dice[1]    else:        score1 = score1 + dice[0] + dice[1];    print ("player 1's score is: %d \nPlayers 2 score is: %d" %(score1, score2));    if (score1 >= 100 or score2 >= 100):        print ("Congratulations! you won");        break;

URL: http://forum.audiogames.net/viewtopic.php?pid=230455#p230455




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Learning Python

Hi, I am working my way through the python tutorial "Learn Python the Hard Way." I have made it up to while loops and I thought I would try and create a simple dice roll game. The game has a player 1 and player 2, and uses two dice. The first to 100 wins. I reasoned out one way to create the dice roll, but I was wondering how would you go about creating a dice roll and get the same result as this by using functions. I know that it is better practice to organize your code by using functions.  Every time I try to write this program using functions though, I run into a issue where I need to call a variable from another function, but I have read in multiple places that using global variables is bad practice. So, can someone help me figure out the logic for this? I am using python 3.Here is my code.from random import randrangescore1 = 0;score2 = 0turn = 0;while True == True:    dice = [randrange(1, 7), ra
 ndrange(1, 7)]    print ("Press enter to roll...");    roll = input();    while roll == "":        print ("You rolled:");        for i in dice:            print (i);        turn += 1;        break;    if (turn % 2 == 0):        score2 = score2 + dice[0] + dice[1]    else:        score1 = score1 + dice[0] + dice[1];    print ("player 1's score is: %d \nPlayers 2 score is: %d" %(score1, score2));    if (score1 >= 100 or score2 >= 100):        print ("Congratulations! you won");        break;TJ Breitenfeldt

URL: http://forum.audiogames.net/viewtopic.php?pid=230348#p230348




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Learning Python

Its written in Python 2.7.10 so it may require a little tweaking, but this might help:import random

class dice(object):
def __init__(self):
self.score1 = 0
self.score2 = 0

self.roll = [0,0]

self.update()

def roll(self):
self.roll = [random.randint(1,7),random.randint(1,7)]

def update(self):
while True:
print('Press enter to roll...')
box = raw_input()

if box == 'q':
break

print('You Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score1 += sum(self.roll)

print('Opponent Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score2 += sum(self.roll)

if self.score1 >= 100:
print("Congradulations! You win!")
break

elif self.score2 >= 100:
print("You lost!")
break

dice()

URL: http://forum.audiogames.net/viewtopic.php?pid=230363#p230363




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Learning Python

Its written in Python 2.7.10 so it may require a little tweaking, but this might help:import random

class dice(object):
def __init__(self):
self.score1 = 0
self.score2 = 0

self.roll = [0,0]

self.update()

def roll(self):
self.roll = [random.randint(1,7),random.randint(1,7)]

def update(self):
while True:
print('Press enter to roll...')
box = raw_input()

if box == 'q':
break

print('You Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score1 += sum(self.roll)

print('Opponent Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score2 += sum(self.roll)

if self.score1 >= 100 or self.score2 >= 100:
print("Congradulations! You win!")
break

dice()

URL: http://forum.audiogames.net/viewtopic.php?pid=230363#p230363




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Learning Python

Its written in Python 2.7.10 so it may require a little tweaking, but this might help:import random

class dice(object):
def __init__(self):
self.score1 = 0
self.score2 = 0

self.roll = [0,0]

self.update()

def roll_dice(self):
self.roll = [random.randint(1,7),random.randint(1,7)]

def update(self):
while True:
print('Press enter to roll...')
box = raw_input()

if box == 'q':
break

self.roll_dice()
print('You Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score1 += sum(self.roll)

self.roll_dice()
print('Opponent Rolled '+str(self.roll[0])+' and '+str(self.roll[1]))
self.score2 += sum(self.roll)

if self.score1 >= 100:
print("Congradulations! You win!")
break

elif self.score2 >= 100:
print("You lost!")
break


dice()

URL: http://forum.audiogames.net/viewtopic.php?pid=230363#p230363




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : Alan via Audiogames-reflector


  


Re: Learning Python

Hi there,Magurp244 has been faster than me ) He answered while I tried to understand python syntax a bit... His code is much more advanced and object oriented, but for a quick revision of your own code, take a look to the following:from random import randrangedef generateNumbers():    result = [randrange(1, 7), randrange(1, 7)]    return resultgoal = 25;score1 = 0;score2 = 0turn = 0;while True == True:    dice = generateNumbers()    print ("Press enter to roll...");    roll = input();    while roll == "":        print ("You rolled:");        for i in dice:            print (i);        turn += 1;        break;    if (turn % 2 == 0):        score2 = score2 + dice[0] + dice[1]    else:        score1 = score1 + dice[0] + dice[1];    print("player 1's score is: %d \nPlayers 2 score is: %d" %(score1, score2));    if (score1 >= goal):        print ("Congratulations! you won");        break;    if (score2 >= goal):        print("Sorry, you loose!");        break;It's my first attempt to code in python, using python 3.4, so don't expect much... Oh, and really I don't understand some of those breaks... but it runs Talking about global variables, I cannot fi
 gure out why someone prevent you from using global variables. In fact, some variables you used (score, turn...) are global variables. It's specially hard to avoid their use working under a non object oriented paradigm as you did in your example, you will need a place to store and share information sooner or later.

URL: http://forum.audiogames.net/viewtopic.php?pid=230378#p230378




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Learning Python

OK, first, that is a little too simple for functions, just use if statements to check it. You need to add something like random turns to make it more reusable. Either that, or add a main menu and whatnot. Here is the basic game, then I will show you when you would use while True:import random

def roller(player):
"""Pass in the player list and it will roll, print the roll, print the total and return the total."""
r = random.randint(1, 6)
player[1] += r
print("%s rolled %s. Now their score is %s/100" % (player[0], r, player[1]))

def change_turn(current_player, player_list):
"""This is called an iterator and it is a built-in object, but because we are just doing a basic alternator, this is probably better"""
if current_player[0] == player_list[0][0]:
return player_list[1]
else:
return player_list[0]

def main():
"""This is a nice little trick that will keep you from using global variables. Instead you are using the variables in the main function. Another trick is to use variables in another module which you will see later in Learn Python the Hard Way."""
player1 = ["Player1", 0]
player2 = ["Player2", 0]
player_list = [player1, player2]
#The next line chooses a random player to start
current_player = random.choice(player_list)
winner = None
print("Welcome to the player dice roler!\n%s is first:" % current_player[0])
while not winner: #What you were looking for is: while True: but frankly you only use that if you don't want the game to ever stop.
roller(current_player)
if current_player[1] >= 100:
winner = current_player
else:
current_player = change_turn(current_player, player_list)
print("%s: %s, %s: %s" % (player1[0], player1[1], player2[0], player2[1]))
raw_input("Press return to continue\n")
print("And the winner is: %s!!! With a final score of %s" % (winner[0], winner[1]))

main()OK, so here is when you don't want your players to leave:import random

def roller(player):
"""Pass in the player list and it will roll, print the roll, print the total and return the total."""
r = random.randint(1, 6)
player[1] += r
print("%s rolled %s. Now their score is %s/100" % (player[0], r, player[1]))

def change_turn(current_player, player_list):
"""This is called an iterator and it is a built-in object, but because we are just doing a basic alternator, this is probably better"""
if current_player[0] == player_list[0][0]:
return player_list[1]
else:
return player_list[0]

def game():
"""This is a nice little trick that will keep you from using global variables. Instead you are using the variables in the main function. Another trick is to use variables in another module which you will see later in Learn Python the Hard Way."""
player1 = ["Player1", 0]
player2 = ["Player2", 0]
player_list = [player1, player2]
#The next line chooses a random player to start
current_player = random.choice(player_list)
winner = None
print("Welcome to the player dice roler!\n%s is first:" % current_player[0])
while not winner: #What you were looking for is: while True: but frankly you only use that if you don't want the game to ever stop.
roller(current_player)
if current_player[1] >= 100:
winner = current_player
else:
current_player = change_turn(current_player, player_list)
print("%s: %s, %s: %s" % (player1[0], player1[1], player2[0], player2[1]))
raw_input("Press return to continue\n")
print("And the winner is: %s!!! With a final score of %s" % (winner[0], winner[1]))

def main():
"""Adds a main menu to the game"""
message = "What would you like to do?\n1. New Game!\n2. exit :("
print(message)
while True:
choice = raw_input("> ")
if choice == "1":
game()
print(message)
elif choice == "2":
break


main()classes make things a whole lot nicer and so do dictionaries, but lists are the most basic. (*huge hint: an instance of a class, dictionary, list and module are pretty much all the same thing.)Thus saying, can you change this so it uses a dict rather than a list, then when you start classes, can you make a player class rather than a dict?

URL: http://forum.audiogames.net/viewtopic.php?pid=230487#p230487




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Is there any difference between using random.randint and random.randrange?

URL: http://forum.audiogames.net/viewtopic.php?pid=230490#p230490




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Learning Python

Randint return's a single number between x and y. Randrange works very similarly, but you can also configure it to skip sets of numbers. For example, if you write:random.randrange(0,10,2)It will return a random number by two step intervals, such as 0, 2, 4, 6, 8, and 10. If you write:random.randrange(0,100,10)It will return a random number at ten step intervals, such as 0, 10, 20, 30, etc.

URL: http://forum.audiogames.net/viewtopic.php?pid=230495#p230495




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Learning Python

When returning things from functions you have to store it in a variable or it will be lost. For example:result = DiceList()This will call Dicelist() which return's dice, its then stored in the result variable for handling. So making that little adjustment it should work fine.from random import randrange

score1 = 0
score2 = 0
turn = 0

def DiceList():
dice = [randrange(1, 7), randrange(1, 7)]
return dice

while turn >= 0:
dice = DiceList()
print ("Press enter to roll...")
roll = raw_input()
while roll == "":
print ("You rolled:")
for i in dice:
print (i)
turn += 1
break
if (turn % 2 == 0):
score2 = score2 + dice[0] + dice[1]
else:
score1 = score1 + dice[0] + dice[1]
print ("player 1's score is: %d \nPlayers 2 score is: %d" %(score1, score2))
if (score1 >= 100 or score2 >= 100):
print ("Congratulations! you won")
break

URL: http://forum.audiogames.net/viewtopic.php?pid=230465#p230465




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Thank you so much. I got it working. This has helped me get a better handle on functions.

URL: http://forum.audiogames.net/viewtopic.php?pid=230484#p230484




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Learning Python

OK, first, that is a little too simple for functions, just use if statements to check it. You need to add something like random turns to make it more reusable. Either that, or add a main menu and whatnot. Here is the basic game, then I will show you when you would use while True:import random

def roller(player):
"""Pass in the player list and it will roll, print the roll, print the total and return the total."""
r = random.randint(1, 6)
player[1] += r
print("%s rolled %s. Now their score is %s/100" % (player[0], r, player[1]))

def change_turn(current_player, player_list):
"""This is called an iterator and it is a built-in object, but because we are just doing a basic alternator, this is probably better"""
if current_player[0] == player_list[0][0]:
return player_list[1]
else:
return player_list[0]

def main():
"""This is a nice little trick that will keep you from using global variables. Instead you are using the variables in the main function. Another trick is to use variables in another module which you will see later in Learn Python the Hard Way."""
player1 = ["Player1", 0]
player2 = ["Player2", 0]
player_list = [player1, player2]
#The next line chooses a random player to start
current_player = random.choice(player_list)
winner = None
print("Welcome to the player dice roler!\n%s is first:" % current_player[0])
while not winner: #What you were looking for is: while True: but frankly you only use that if you don't want the game to ever stop.
roller(current_player)
if current_player[1] >= 100:
winner = current_player
else:
current_player = change_turn(current_player, player_list)
print("%s: %s, %s: %s" % (player1[0], player1[1], player2[0], player2[1]))
raw_input("Press return to continue\n")
print("And the winner is: %s!!! With a final score of %s" % (winner[0], winner[1]))

main()OK, so here is when you don't want your players to leave:import random

def roller(player):
"""Pass in the player list and it will roll, print the roll, print the total and return the total."""
r = random.randint(1, 6)
player[1] += r
print("%s rolled %s. Now their score is %s/100" % (player[0], r, player[1]))

def change_turn(current_player, player_list):
"""This is called an iterator and it is a built-in object, but because we are just doing a basic alternator, this is probably better"""
if current_player[0] == player_list[0][0]:
return player_list[1]
else:
return player_list[0]

def game():
"""We just change the title here so it is not main which is used for the master function"""
player1 = ["Player1", 0]
player2 = ["Player2", 0]
player_list = [player1, player2]
#The next line chooses a random player to start
current_player = random.choice(player_list)
winner = None
print("Welcome to the player dice roler!\n%s is first:" % current_player[0])
while not winner: #What you were looking for is: while True: but frankly you only use that if you don't want the game to ever stop.
roller(current_player)
if current_player[1] >= 100:
winner = current_player
else:
current_player = change_turn(current_player, player_list)
print("%s: %s, %s: %s" % (player1[0], player1[1], player2[0], player2[1]))
raw_input("Press return to continue\n")
print("And the winner is: %s!!! With a final score of %s" % (winner[0], winner[1]))

def main():
"""Adds a main menu to the game"""
message = "What would you like to do?\n1. New Game!\n2. exit :("
print(message)
while True:
choice = raw_input("> ")
if choice == "1":
game()
print(message)
elif choice == "2":
break


main()classes make things a whole lot nicer and so do dictionaries, but lists are the most basic. (*huge hint: an instance of a class, dictionary, list and module are pretty much all the same thing.)Thus saying, can you change this so it uses a dict rather than a list, then when you start classes, can you make a player class rather than a dict?

URL: http://forum.audiogames.net/viewtopic.php?pid=230487#p230487




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

[[wow]], thanks Frastlin I think this is exactly what I wanted. This is a little confusing, but I have learned all of these concepts, so I am going to study your code to try and figure out exactly what your doing.

URL: http://forum.audiogames.net/viewtopic.php?pid=230489#p230489




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : momo7807 via Audiogames-reflector


  


Re: Learning Python

HiPost 7, I have a question.When creating a user function, how to end up a function?For example, other languages such as pure basic, autoit, c#, c++, bgt, vbhas an end of the functionc#, c++, bgt can define a function using void bla bla bla and bracketsYou put left bracket on the function's starting point, and put a right bracket on the end of the function.But how to end up a function in python?Python has the def keyword only, and can't use brackets on start or end of the function.

URL: http://forum.audiogames.net/viewtopic.php?pid=230503#p230503




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : momo7807 via Audiogames-reflector


  


Re: Learning Python

Thanks for answering my questions.

URL: http://forum.audiogames.net/viewtopic.php?pid=230541#p230541




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: Learning Python

you can create a variable named true (lowercase t) and set it to the boolean value of True (capitol t). but as i said, thats not very good practice. for example, if you are making a while loop to loop until a specific number is rolled i might use:target_rolled = False
while not target_rolled:
#blah blah blah codebut you see. use a variable that pertains to what it is you're doing.

URL: http://forum.audiogames.net/viewtopic.php?pid=230451#p230451




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: Learning Python

the reason people say not to use global variables, is that this one variable is jumping all around to many different scopes of the program and being modified all the way. so if a bug comes up based on that global variable, it probably will be much harder to pin point exactly what is causing that error if it is global vs local. the idea of structuring your coding into classes and the like does help with some of that. also, using the return statement after functions does help as well.i'm not sure if the random module differs between python 2 and 3, but i used random.randint(1,6). might just be about the same thing.fyi, i'd never use true as a variable name. you want to avoid names like that that are already in python, true, false, print, class, and i/j/p. there are probably a few others.

URL: http://forum.audiogames.net/viewtopic.php?pid=230389#p230389




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : momo7807 via Audiogames-reflector


  


Re: Learning Python

HiThanks so much. One more question. Can I use more then one statements with many spaces, like brackets in other languages?

URL: http://forum.audiogames.net/viewtopic.php?pid=230511#p230511




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : momo7807 via Audiogames-reflector


  


Re: Learning Python

Then, Can I define a function, indent it with two spaces, Use the if statement, and Can I just end up just the if statement in the function by decreasing a space?Sorry for my lots of questions. Lol indentation is very confusing

URL: http://forum.audiogames.net/viewtopic.php?pid=230514#p230514




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: Learning Python

*Note* you don't need to put ; at the end of your lines.Yes, if you go out an indentation it is like putting a }Here is sudo _javascript_ python using braces to show you what is going on.def my_function(){print("Hello world")}so no return is needed, it does it for you. It automatically does:return Nonewhich is void. As an example:def my_func(blah):  if blah.startswith("h"):    if blah.endswith("d"):      print("Hello world")    elif blah.endswith("k"):      print("No idea")  else:    print("Maybe your name?")You can also make a function in a function, but there is very few reasons for it:def func1():  def func2(joe):    print(joe)  print("Outside the second function's deffinition, but 
 before the return of function1")  return function2function1("My name is frastlin")

URL: http://forum.audiogames.net/viewtopic.php?pid=230522#p230522




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : momo7807 via Audiogames-reflector


  


Re: Learning Python

HiPost 7, I have a question.How to specify the end of the function in python?Other programing languages use brackets or function, end function keyword, but python does not. We define a function using def keyword. And We write the body of the function. And how to specify the end of the function?

URL: http://forum.audiogames.net/viewtopic.php?pid=230505#p230505




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Functions in python use indentation, so once you stop indenting python knows that everything else is not in the function. example:function example():    print ("This line is indented four spaces");    print ("All lines in the function must be indented the equal amount of space");print ("this is not apart of the function because it is not indented and against the margin.");

URL: http://forum.audiogames.net/viewtopic.php?pid=230507#p230507




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

I am not sure if I understand what you mean by "more then one statements"You can stack indentations though. Say you have a function and an if statement inside that function, the code with in an if statement is indented just like a function, but because the function has already indented the if statement you would now have to indent the code for the if statement 8 spaces rather than 4 spaces. That may have been confusing, here is an example.def example():    print ("this is a line inside the function that is indented 4 spaces");    if (5 > 3):        print ("5 is greater than 3. This is indented 8 spaces because you have to indent the code for the if statement");print ("this is outside the print statement");you can nest as many statements as you want inside each other like any other language, but you have to keep track of the spacing.

URL: http://forum.audiogames.net/viewtopic.php?pid=230512#p230512




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Learning Python

2015-09-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: Learning Python

Yes, you can use any number of spaces as far as I can tell, however using 4 spaces or the tab key seems to be the standard. I have heard in a couple places not to use tabs, but I think it is just preference. I use tabs because it is much easier to work with and Jaws reads tabs very well in ed sharp (the text editor I use). Also, it is not as time consuming having to press the space bar so many times, and you can still stick with the standard since a tab is equal to 4 spaces. note: I used spaces in my post because it seems to be easier for jaws to identify the indentation since he only reads blank if you are navigating character by character. if you use a screen reader I recommend turning on the setting so that the screen reader will read indents at least just for your preferred tool for editing python code.

URL: http://forum.audiogames.net/viewtopic.php?pid=230521#p230521




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

  1   2   >