Any other programmers out there?

Discussion in 'Community Discussion' started by DemonThunder345, Jan 4, 2015.

  1. Well I've been interested in computers since I opened my eyes and I just love computer stuff. I'm wondering if there is any other programmers out there though.. I program in Python atm and soon I'm going to learn c, c++
    So I guess we can just talk programming stuff and share our code for games and stuff...
    This is the code for a stupid game I made ages ago and never finished... So yeah it's old and has just basic stuff in it.
    import random
    print("Welcome to the lame game")
    name = input("what is your name?")
    print("alrighty then, welcome", name)
    print("You are in a forest and its pretty dark")

    right = input("Do you chose to go right?")

    if right == "no":
    print("Good")
    else:
    print("You fall in a hole and die")
    left = input("What about left?")
    if left == "yes":
    print("Good job you went the right way")
    print("LEVEL UP, you are now level 2")
    else:
    print("u fail brah")
    input("Press return to exit")
    inventory = []
    if not inventory:
    print("you are empty handed")
    raw_input("press return to continue")
    chest = ["Gold", "Airplane", "Banana"]
    print("You find a chest, it contains:", chest)
    yes = input("Do you take it?")
    if "yes" in yes:
    print("Great!")
    inventory += chest
    elif "no" in yes:
    print("aw shucks you shoulda took it")


    print("Your inventory includes:")
    for item in inventory:
    print(item)

    ap = input("You see a villager in the distance, do you approach it?")
    if "yes" in ap:
    print("The villager sees you approach, he asks if you would like to buy something")
    elif "no" in ap:
    print("You walk away but the villager looks no harm, so you approach him anyways")
    villager = ["Sword of justice"]
    print("you see that he has a weapon and is willing to trade it for gold")
    raw_input("press return to trade")
    if "Gold" in inventory:
    print("Great you now have the Sword of justice! You will be able to fight goblins later on!")
    del inventory[0]
    else:
    print("You dont have gold so you cant trade.")
    raw_input("Press return to continue")
    print("You approach a wizard who offers you a choice, You can play the game of chance to win a potion and a battery, but if you lose, you lose one of your possesions. You can decline, but you will need the potion and battery later on.")
    chance = input("Do you take the chance?")
    if "yes" in chance:
    potion = random.randrange(1,2)
    if potion == 1:
    print("Congrats, you win the potion + battery!")
    crap = ["potion", "battery"]

    inventory += crap
    elif potion == 2:
    print("Oh well you lose, Now your banana is mine!")
    del inventory[2]
    elif "no" in chance:
    print("Oh well, your choice.")


    So share your stuff people
    eklektoi likes this.
  2. Firstly, I'd recommend that you put your code into code tags :p

    Secondly, I'd recommend you learn something like PHP (or almost any language) before learning C/C++ as they are essentially the most advanced languages you get. Javascript is a good little language similar to python. If you want to then move into more advanced language I'd recommend Java.

    I don't know Python but I'm sure that there will be a few people on here who do.
    sambish20 likes this.
  3. I'm learning the basics of programming with Python and then I'll move on to Java and so on.
  4. I know some PHP and I know really basic Java that I'm trying to improve. Even though it's not a programming language, I take great pride in learning HTML since it's the only programming-related thing I ever bothered to completely learn :p
    sambish20 likes this.
  5. I have always been really interested in computers and started by learning BASIC. From there I did some web stuff like javascript and HTML. I even made this pretty terrible canvas game called 3d pong that I think got deleted. From there I learned a lot of Java and am currently looking at a cool tutorial series that teaches c++ in the context of game programming.
  6. Like SoulPunisher, even though HTML isn't considered a programming language, I know that. I also know Python fully :)
  7. .NET stuff (I mostly use VB.net), any flavor of SQL, and then the usual smattering of javascript, html, ASP, css, xml, xslt, getting annoyed at AJAX controls, and a bunch of others that are long mostly dead. I'll likely be learning Java next. I know barely enough to be dangerous. Need to get proficient with it.

    Programmer humor - https://www.destroyallsoftware.com/talks/wat
  8. I know Python. :) Nothing else though. Python is good enough for me... for now. First Python, then the world!
    khixan likes this.
  9. My dad does a lot of programming, he is an engineer for the company that makes cinema 4D.
    I have learned Python well enough but haven't gotten to the deeper flesh of programming. If you'd like...
    Code:
    import math
    
    
    #Adds two onto "x" every time
    
    def add(val):
        val += 2
        
        return val
        
        #x += 2
        
        # Not sure if this will work when called from another command line.
        
    def decimal(val):
        
        return int(val)
    
    
    
    def piprgm():
    
    
    
        # says how much "x starts off as"
        x = 1.0
            
     
        # says how to start the process
        uf = 4 / x
        print 'sucess! Just wait...'
        i = 0
        while i <= 1000000:
            i += 1
            x=add(x)
            unfin = uf - 4 / x
            x=add(x)
            fin = unfin + 4 / x
        
            if float(i) / 250000.0 == decimal(float(i) / 250000.0): 
                print "============================================="
                print 'Number of iterations: ' + str(i)
                print 'Current Value: ' + str(fin)
                print 'Distance away from pi: ' + str(fin - math.pi)
                print "============================================="
    
        
            #print '==='
            #print fin
        
            #print int(fin)
        
            uf = fin
        
        
        print "============================================="
        print fin
        
        
        
    piprgm()
    
    It is really inefficient, but it gets the job done. It calculates pi. :p
    The code is also really messy and I have notes that remind me what everything does, so ignore those...

    Edit: also, I use an app on the apple App Store called pythonista. It lets you code on your phone and has a bunch of additional libraries that are cool to screw around with.
    eklektoi likes this.
  10. For those on android who want to enjoy writing and running python code, search qpython3 or qpython depending on the version you like. Although I don't python much, there are some cool ways it integrates such as displaying toasts, using bluetooth, and integrating with tasker (so pretty much anything you want it to do).
    Edit: It can actually run many ui elements and when used with tasker, can do pretty much anything. Didn't realize how powerful it was until now :p
  11. I use pythonista, I'm currently making a big game right now
  12. Something extremely stupid I'm working on

    import time
    import sys
    humanlife = 10
    deadpiggies = 0
    inventory = ["Orphan","Gun", "Hand gernade"]
    ammo = 7
    def choices():
    print("Choice 1: Shoot the piggie.")
    print("Choice 2: Use orphan as shield")
    print("Choice 3: Throw grenade.")
    def otherchoice():
    print("Choice 1: Shoot the piggie.")
    print("Choice 2: Throw gernade.")
    def otherchoice2():
    print("Choice 1: Shoot the piggie")
    print("Choice 2: Use Orphan as shield.")
    def otherchoice3():
    print("Choice 1: Use Orphan as shield")
    print("Choice 2: Throw gernade")
    class Player (object):
    def blast(self, enemy):
    print("The Piggie has been murdered")
    enemy.die()
    class Lilpiggie (object):
    piglife = 5
    def checklife(self):
    print("Checking pigs life:\n")
    if self.piglife <0:
    print("The pig is dead")
    else:
    print("The pig lives!", piglife, "Life left.")
    def die(self):
    print("ARGHHHHRHRH\n")
    print("A pig has been slayen!")
    def attack(self):
    print("Pig Attacks!")
    humanlife -= 1
    print("Your health is now:", humanlife)
    if humanlife <0:
    print("You are dead.")
    sys.exit()
    def talk(self):
    print("Ahajdhdbcjsisndj")
    Avi = Player()
    lilpiggg = Lilpiggie()


    print("Welcome to the lame game 2.0.\n")
    print("You are Kermit the frog, you have just awoken from your deep hyperspace which spanned over 90000 years\n")
    time.sleep(3)
    print("During this time, Mrs. Piggie has taken over the planet and you have been hired by the A.V.I to take out Mrs. Piggie and restore balance to the universe!\n")
    print("We have supplied you with a few gadgets:")
    for item in inventory:
    print(item)
    time.sleep(2)
    print("*LANDING GEARS ACTIVATE*\n")
    print("TouchDown! We have landed lets take out our first Little Piggie.")
    lilpiggg.talk()
    time.sleep(1)
    print("He is getting closer!, do something!!!")
    choice1 = input("Do something? [Y/N]\n")
    if "y" in choice1:
    Avi.blast(lilpiggg)
    deadpiggies += 1
    print("You have slayen:", deadpiggies, "Piggies\n")
    elif "n" in choice1:
    print("The pig charges but he misses and runs into a pole and dies.")
    else:
    print("Enter a real choice next time")
    sys.exit()
    print("You enter a large room full of piggies, but in the distance you see Mrs. Piggie ripping open an unborn fetus and eating it.\n")
    print("A pig sees you.")
    choices()
    choice2 = input("Choice:")
    if choice2 == "1":
    print("FIRE!")
    ammo -= 1
    deadpiggies += 1
    print("You killed", deadpiggies, "and have", ammo, "left")
    elif choice2 == "2":
    print("ORPHAN SHIELD!!!!")
    print("Lil Piggie bounces back into oblivion")
    deadpiggies += 1
    del inventory[0]
    print("You killed", deadpiggies, "Pigs")
    elif choice2 == "3":
    print("Gernade!")
    print("Pig explodes")
    del inventory[2]
    deadpiggies += 1
    print("You have killed", deadpiggies, "Pigs")
  13. cout << "\t\t\tI learned basic C++ this term.\n";
    cout << "\t\t\tDid you?\n";

    char yesno;

    cin >> yesno;

    if(yesno == 'Y' || yesno == 'y')
    {
    cout << "Twins!";
    system("break");
    }

    if(yesno == 'N' || yesno == 'n')
    {
    cout << "Not twins :c";
    system("break");
    }
    mba2012 and DemonThunder345 like this.
  14. Skip C, go straight to C++ when you are ready. C++ is essentially an iteration higher of C, and there are many parts of it that it does better than C. Most all of the good in C was passed onto C++, and the bad was replaced, so if you were to start on C, you would just be slowing your progress.

    I can program in C++ pretty decently (not to toot my own horn), and am going into and advanced level Java class this semester. People say that learning to program is like learning a second language. They also say that C++ is a difficult language to learn. I could barely scrape by learning Spanish from a great high school teacher, but I learned C++ quite easily from a great professor. If anyone is interested in C++, I highly encourage you to try several different YouTube professors you find before giving up.
    ChickenDice, khixan and mba2012 like this.
  15. I just learned how to make it so you can access global variables inside a function! Awesome!