I made a 🐍Snake AI 💻
DynamicSquid (5029)

[ currently broken :D ]

Hi!

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!

But.....

When you press space, it uh... helps you out a little :)

Enjoy!

You are viewing a single comment. View All
fuzzyastrocat (1867)

@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 str() and 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 int and str functions, but the function itself is used as the type it casts to.)
  • Great!

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!"