One thing that I find fun is random text generation. Making a body of text and replacing it with random options or input. You could try making mad libs stories, or allowing the user to type options for it to choose from. Other people said text adventures which is a good idea.
from collections import namedtuple
FieldEntry= namedtuple(‘FieldEntry’, ['location’, ‘pet’, ‘activity'])
journal= FieldEntry([input() for n in range(len(FieldEntry._fields))])
text= f’Today I took my pet {journal.pet} to the {journal.place}, and we had a good time {journal.activity}!'
You could make a script that creates an html document using short symbols to replace bigger code blocks, such as the letter h for heading followed by 1-6, or the letters s, n, or p, for same, next, or previous level referring to the last heading created.
last_heading= 1
document= ‘<body>'
text= input()
#the first 2 letters signify a heading, then a space, and the heading title
if text.startswith(‘h’) and text[2]== ‘ ‘:
document+= add_heading(text)
document+= ‘</body>’
def add_heading(text: str):
global last_heading
text= text.split(‘ ‘,1) #index 0 is the heading and index 1 is the title
if text[0] in set(‘123456’):
last_heading= int(text[0])
elif text[0]== ’n’:
last_heading+=1
elif text[0]== ’p’:
last_heading-=1
elif text[0]!= ’s':
return ''
return f’<h{last_heading}>{text[1]}</h{last_heading}>'
you could build a rock paper scissors game where the user can make their own items.
import random
def rps(player: str):
game= {
'r': {'name': 'rock', 'strong': {'s'}, 'weak': {'p'}},
'p': {'name': 'paper', 'strong': {'r'}, 'weak': {'s'}},
's': {'name': 'scissors', 'strong': {'p'}, 'weak': {'r'}}}
if choice not in game:
return 'Invalid choice. Available choices:\n'+ ', '.join(list(game.keys()))
cpu=random.choice(list(game.keys()))
if cpu== player:
return f'Hmm, I also chose '+game[cpu]['name']+'. It\'s a draw!'
elif cpu in game[player]['weak']:
return f'Well done, '+game[player]['name']+' beats '+game[cpu]['name']+'. You won!'
elif cpu in game[player]['strong']:
return f'Too bad, '+game[cpu]['name']+' beats '+game[player]['name']+'. I win!'
#neutral choice
return game[player]['name']+' and '+game[cpu]['name']+' are equal. It\'s a draw!'
choice= input()
print(rps(choice))
My first actual project was the rhythm rage level creator. Over time I learned more concepts and learned to attach them to the existing project, or figured out what I needed to learn once I had an idea of what I wanted to do with the project.
I actually didn’t think about the level creator immediately. I just started with the thought of, "let’s make an empty script and build”. I barely knew the difference between a sound object and sound pool, so the first task was making a sound object play, and then exit. The next step was adding a key that plays something with the sound pool while that sound object was playing.
Next what I did was have it write a file with example text every time I pressed the key, along with the sound it played. It was only after this, that I realized how simple it was to create a level creator for rhythm rage. Well, not a good one, but one none the less.
When first starting out, the code is a mess. Just copying and pasting similar lines of code because you want functionality more than anything. It’s a bad habit, but we all do it in the beginning. Next thing I know, aliases are apart of the script. I just added a global variable that changes each time you press space, with aliases enabled.
One thing to know is that I didn’t have a timer yet, I used the sound object to tell what position in milliseconds the key was pressed.
Then I posted it to the forum to get feedback, because I didn’t know where to go from there. People gave me a bunch of suggestions, and I thought about how I could add them. I didn’t know how arrays worked, so that and timers were things I had to figure out. Then dictionaries. And so on. Eventually, the project got more capabilities, and still ended up a pile of garbage and terrible code. Then one day I switched to python and abandoned the project.
I just messed around with random components until an idea struck me. Something simple that I could accomplish immediately, though knowing it would start out pretty much useless, and admittedly still ending up just as useless haha.
But because this is python instead of bgt, you aren’t forced to make a function with a while loop consisting of key press if statements in order to test things or make projects. In fact I don’t recommend doing that. My first python project was attempting to write my own game engine, using pygame because of course it would be. It was a massive failure and waste of time. Sure I built some things with it, but I didn’t learn much and it only served to continue reenforcing those bad habits from bgt. A lot of which I still have.
I built the sequence storm announcer tool using the engine, and that was a nightmare. I’ve since expanded to learning from different sources such as NVDA addon development, and discord bots. Though it’s just for a hobby, not serious development, so I’m not progressing much with programming.