Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: Python programming! Too much inspiration, too little skill (and goals).  (Read 5828 times)

The Moonlit Knight

  • Bay Watcher
    • View Profile
Re: Python programming! Too much inspiration, too little skill (and goals).
« Reply #15 on: March 07, 2009, 06:19:01 pm »

Glad there are other folks out there learning Python. Took the advice to just start coding; at the moment I'm just working on a character (sheet) generator/editor for this free zombie survival RPG I found called The Dead, which looks pretty neat. Gonna run it tonight.

I've definitely got print and input and variables and all kinds of math down, so that's pretty cool. It's nice to just be able to try a small project and know I can complete it, even if it's sort of insignificant. I suppose I'll move onto an actual game of some kind any day now.

What IDEs are you all using? I'm using NetBeans' Python release at the moment, seems to work pretty nicely for my purposes at the moment, but that Sphere IDE sounds pretty neat.

Quote from: Keiseth
Fualkner's idea is to have an item system where you can make things from parts, using some sort of interface for the placement of pieces.
Well damn, I had that idea, too. I've got some thoughts as to how it could work, but nothing solid yet since I've hardly even touched anything having to do with game programming anyway. I'd be interested to hear how you manage(d) to make it work.
Logged
A man once said to me, "If you want superpowers, all you have to do is take acid and you'll have any superpower you want." He then asked if I had just, at that moment, shaved half my face; I revealed that as being my superpower. Being suddenly and inexplicably half-shaven.

Derakon

  • Bay Watcher
    • View Profile
Re: Python programming! Too much inspiration, too little skill (and goals).
« Reply #16 on: March 07, 2009, 06:57:27 pm »

I just write my code in vim, a powerful text editor. Keep a commandline open to invoke the script and I don't really need an IDE.
Logged
Jetblade - an open-source Metroid/Castlevania game with procedurally-generated levels

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Python programming! Too much inspiration, too little skill (and goals).
« Reply #17 on: March 07, 2009, 07:40:51 pm »

Also, if you use values over 1, it will either repeat the texture or a 1 pixel border depending on a setting(It may have a diffrent setting for each of the X and Y dimensions to allow more power to the user...)


I work with C and openGL on a whenever-I-feel-like-it basis, so over the past year and a bit I have learned quite a bit. I have got to the point of creating large textures from individual tiles for use in a game engine or something(I hope to make something like metroid sometime) although it still won't draw to the textures for me...
Logged
Eh?
Eh!

Shikogan

  • Bay Watcher
  • Comically insane
    • View Profile
Re: Python programming! Too much inspiration, too little skill (and goals).
« Reply #18 on: March 09, 2009, 12:30:48 am »

THREAD HIJACK...for the time being.
I already created a thread about this but i really need any help ASAP, thanks.


Question 1


Part 1
Create a procedure called printSquareStar(), using printNString(string, numTimes), that prints the following using printNString.

****
****
****
****

This is a 4x4 square made up of the star (*) character.

Answer
def printSquareStar():
   printNString('*', 4)
   printNString('*', 4)
   printNString('*', 4)
   printNString('*', 4)

NOTE: This part is done

Part 2
Create a procedure printStarRectangle(height, width) (where string is a string and height is an integer) that prints a rectangle height units high and width units wide using '*'s. You should use printNString.

Example: printStarRectangle(5,3) =>

***
***
***
***
***

Answer
def printStarRectangle(height, width):
    n = 1   
    while n <= height:
        printNString('*', width)
        n = n + 1

NOTE: This part is done

Part 3

Create a method called printTriangle(string, height) (where string is a string and height is an integer) that prints a right angled triangle height units high using string as the character string.

Example:
printTriangle('*', 2) =>

*
**


printTriangle('a', 3) =>

a
aa
aaa


Part 4

The goal of this exercise is to write a function that can draw two different types of shapes. Create a method printShape(shape, string, height) (where shape is a string, string is a string and height is an integer) that prints either a triangle or a square to the console depending upon the shape string. The variable shape will equal to 'square' when you are to print a square and otherwise it will be 'triangle'.

For the purpose of this exercise you may assume a printSquare(string, height) function and a printTriangle(string, height) function exist.

Question 2
Define a procedure p2(n) that takes an integer parameter n. If n is greater than 1, the procedure returns the largest power of two that is less than n; otherwise, it returns 0.
Hint: You will need to use a while loop. Here is an example of a function that adds the numbers from 1 to n

def sumto(n):
    sum = 0
    m = 1
    while m <= n:
        sum = sum + m
   m = m + 1
    return sum

For your problem you will need to take increasing powers of 2 until that power exceeds n.
Logged
Arguing on the internet is like running in the special Olympics; even if you win you're still retarded.

Duke 2.0

  • Bay Watcher
  • [CONQUISTADOR:BIRD]
    • View Profile
Logged
Buck up friendo, we're all on the level here.
I would bet money Andrew has edited things retroactively, except I can't prove anything because it was edited retroactively.
MIERDO MILLAS DE VIBORAS FURIOSAS PARA ESTRANGULARTE MUERTO
Pages: 1 [2]