I made a 🐍Snake AI 💻
[ currently broken :D ]
I made Snake. You can control it using WASD, or the arrow keys. Eat the red apples, and don't crash into the walls or yourself!
When you press space, it uh... helps you out a little :)
"Wait! Please make sure you give us a one-star review! Also, don't go out, its not safe"
"Why do you care?"
"We also have a policy that we should protect annoyed customers"
"Lemme guess, your 'policy designer', the rat, created this policy?"
"No sir, this was created by our Customer Care team of specialists"
"What? Humans made such a dumb policy?"
"I never said they were humans...a parakeet, a chimpanzee, a kangaroo, and a snek make a fine team, don't they?"
"I do not even want to imagine what a snek is..."
"But you obviously came for our famous Slice of Night, so we had it prepared in advance. We also make assumptions about our customers, so we prepared this 'mystery meat' just for you."
"You happen to be correct, I love mystery meat."
Customer takes a bite
Chef runs in
"WHERE IS MY RAT?!"
@DynamicSquid You could add:
- Some kind of interesting memory management paradigm. Perhaps ownership-style?
- A type system like Haskell's, where you can pass types to functions as if they were normal values. Basically, making types "first-class citizens".
- Multiple dispatch. This one is neat, I'd highly suggest it. Basically, in most OO langs you have single dispatch — when I call
some_functionI'm calling depends on the type of
my_var. Well, what if the function depended on the types of all arguments? So, instead of doing:
def my_function(x, y, z): if type(x) is int and type(y) is str and type(z) is int: # stuff 1 elif type(x) is str and type(y) is int and type(z) is str: # stuff 2 # etc etc
You do something like:
def my_function (x: int, y: str, z: int): # stuff 1 def my_function (x: str, y: int, z: str): # stuff 1 # etc etc
And obviously, you don't have to give a type — doing
def x(y): would apply to
y of any type.
More info on multiple dispatch can be found here.
@fuzzyastrocat What so what do you do in Computer Science class then?
- Oh no. I've already have enough nightmares about memory ownership in Rust lol
- That seems interesting, but I feel like it might seem off in a dynamically typed lang
- Ooh... that seems really interesting... definitely going to look more into that
@DynamicSquid There is no computer science class.
- Eh, I don't mean strictly rustian. You could probably make it your own, I'm just saying it'd be neat to have a unique memory management scheme.
- Well, I'm not sure. I mean, the functions
int()exist in Python, so why can't the types themselves exist as entities? (Or, maybe each type is a function, and when called that function casts the argument to its type. So basically like Python's
strfunctions, but the function itself is used as the type it casts to.)
A lang with both the second and third ideas could be cool:
int # => the "int" type, which is actually a function int("32") # => calling the int function, which casts "32" to an int class MyType: # a demo type pass int(MyType()) # oh no, there is no dispatch for type `MyType` in the int function! def int(x: MyType): # adding a dispatch option print("Hooray!") int(MyType()) # => "Hooray!"
Hey, @firefish, care to help me on something?
So I checked the GitHub Linguist guide, and in order for them to add syntax highlighting to a user made language, it must be in at least 200 repositories.
For example, this person tried to add their own language, but fell short of the 200 person requirement.
Right now, a total of
NullPointerException repositories on GitHub are written in Night.
Which means we're actually really close. If my math is correct then we only need
200 - 0 = 20 repositories and then we can add a language on GitHub!
Now I'm not saying that I want to get 200 people using Night right now. It'll probably take decades, or perhaps never, I'm perfectly fine with that, but I'd be interesting to try...
So got any ideas?