Jump to content

Cyber_Spectre

Member
  • Posts

    15
  • Joined

  • Last visited

  • SteamID

    76561198067527430

Posts posted by Cyber_Spectre

  1. ##Crazy.py
    #######
    #Purpose: Count to the number 10
    
    
    import sys
    import time
    
    
    def nummy(numbers):
        
       #@ return void
       #Take the binary amount and convert that into decimal -> charcters -> decimalOfCharacter -> hex of ASCII
       #Convert Hex back into decimal to print
    
       #Create an array to store information about our numbers
       nums = []
       # Create this array to show ASCII Chars 
       chars = []
    
       #convert decimal into ASCII chars
       decimal = int(numbers,2)
       #Loop from 1 -> n + 1  ie 1-10
       for c in range(1, decimal+1):
          # Have to append to an array to actually show this
          chars.append(str(chr(c)))
    
       #Print the cool ASCII 
       sys.stdout.write("ASCII Chars:" + str(chars) + "\n")
       
       
       # from 1 to (n + 1) convert this from decimal to char to decimal to hex
       for i in range(1, decimal+1):
          nums.append(hex(ord(chr(i))))
    
       #Print the final outcome of HEX
       print("HEX: " + str(nums) + "\n")
    
       #Use a 'with' statement, because I sometimes forget to close file
       #
       with open("readthis.txt", "w") as f:
          for i in nums:
             f.write(i + '\n')
    
       #Clear the array to allow for 'new' data
       #Not really...it's the same crap lol
       nums.clear()
    
       #Make it seem the program is doing something important
       sys.stdout.write("Doing some important ST0xFF.." + "\n")
       time.sleep(2)
       
       #Open our file and read it as a var of 'f'.
       #Read every single line and split them up, not have i.e. 0x\0x1\0x2 etc.
       with open("readthis.txt", "r") as f:
          x = f.read().splitlines()
          
          #Append this to our 'cleared' array nums
          for i in x:
             nums.append(i)
       
       #Loop through the nums array and convert all of the hex to decimal and show to the user
       for i in nums:
          sys.stdout.write(str(int(i,0)) + " " )
    
       
          
           
    #main method
    def main():
       #Give the option to put in however many numbers you want
        userNum = int(input("Enter number: "))
        #call the function nummy and plug in numbers converted to binary
        sys.stdout.write("Inserting: BINARY -> " + str(bin(userNum)) + "\n")
        nummy(bin(userNum))
        
        
    
    main()

    something.PNG.3ede91f04ef786bbfd77071f8b1f6368.PNG

     

    Allowed the user enter an arbitrary amount of numbers to the program: arb.thumb.PNG.1d2722979b1e602c79e7ee005ddf78ae.PNG

     

    Thought this was a great idea @_Rocket_! Thanks. Can't wait to see what others put here.

     

    This is no way the most complicated way. I may change it

     

     

    *If someone just does straight up assembly I would be amazed. ;)*

    #Also I saw no reason to check for non-positive numbers, try it out ^#

  2. normal.PNG.af7e7e3d204cc513c320455597380961.PNG

     

    I've been messing around with sprites and animations in SFML. I tried to animate the tux penguin from Linux and came out with this. In fact, I believe I might make this the player. I mean, why not? What do you all think?

     

  3. @Nick @_Rocket_

     

    Thank you both for sharing your coding styles and making this thread very interesting. Thanks for the "godbolt" website, I'll be using this more often. A neat fact I learned is that switch statements are faster than nested if-else-if statements, here's the link to the original thread: https://stackoverflow.com/questions/2158759/case-vs-if-else-if-which-is-more-efficient

     

    Results:

    http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx

     

     

    @Beaker

    I've been good man, how you have been? I'll be on soon!

     

  4. This is very interesting, I haven't seen a C++ programmer write  like this. I might test this out? Have you noticed any performance differences with writing your code directly in header files, compared to their source  files? Overall, every programmer writes differently. In regards to your game what is it about? And Steam? I admire you for doing this. Good luck on your goal, I'll be cheering you. Furthermore, thanks for sharing your coding style and a little bit of your game. If you ever need a beta tester, I would not mind testing it out.

  5. Just from "sf::" I know your using SFML. In fact I am currently making a game in C++ with this library, for Anti-Cheat research.  When you finish your game, I would like to play it. Have fun in your coding adventures.

×
×
  • Create New...