(shouting)

The Thread for Programming

here's a good place for FRIENDLY, ENJOYABLE, and otherwise very GENERAL discussion!
User avatar
docopoper
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non pharetra enim, nec maximus odio.
Posts: 78
Joined: 12 years ago
First name: Shane Farrell
Pronouns: they/he
Location: Ireland

Re: The Thread for Programming

Post by docopoper »

WhattayaBrian wrote:Waits for modules
Wallows around in Python. In college my best friend is the guy that uses C++ all the time and I'm the guy that uses Python all the time. We are constantly talking about it and debating for our sides.

... This thread is too C++ oriented for my liking. :P
The first thing I would do with infinite power would be to make myself a cave where I could look at my shadow forever.

Image <- Go team Yeah Doctor Shemp.!
Image <- That's everyone being nice to me. ^^

I made a game called Utter Confusion! Play it! :D
It's a lot of fun and has been incredibly popular at every indie game dev party I've brought it to.
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

That's because python is so easy. No one has any questions about it!
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
lukaramu
not lukaramu
Posts: 0
Joined: 11 years ago
First name: not lukaramu
Location: the place where i live

Re: The Thread for Programming

Post by lukaramu »

I used Python when I started delving into programming for real for the first time and I still kinda like it for really quickly sketching out ideas if I don't have much time for something.
User avatar
docopoper
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non pharetra enim, nec maximus odio.
Posts: 78
Joined: 12 years ago
First name: Shane Farrell
Pronouns: they/he
Location: Ireland

Re: The Thread for Programming

Post by docopoper »

Code: Select all

import solution

solution.answer()
I'm really good with Python. Though admittedly I'm bad at C++, I'm still in the phase of "this is C with strings, vectors and classes"... Which I know is terrible. I think the last code I wrote in C++ even used pointers directly. I've never used unique pointers or any of that...

Honestly C++ intimidates me in how it has a large number of ways to do everything each with advantages and disadvantages, it's got some really unintuitive restrictions that only make sense when you know how things are loaded internally and the errors are little more than the linker screaming in pain.

... Other than that I really admire the language and am amazed by how much it can do while still being compiled and how quickly it runs. I know I should learn it at some point. But god is it less nice than Python (I know the major languages you typically learn as a programmer and in a CS course in case anyone thought I only knew Python; I in fact started with GameMaker ten years ago).
The first thing I would do with infinite power would be to make myself a cave where I could look at my shadow forever.

Image <- Go team Yeah Doctor Shemp.!
Image <- That's everyone being nice to me. ^^

I made a game called Utter Confusion! Play it! :D
It's a lot of fun and has been incredibly popular at every indie game dev party I've brought it to.
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

At some point I want to try using Python as a scripting language integrated into C++, like how Lua is used. I've looked into it before, and it seems like, instead of telling Python about your C++ classes directly (like with Lua), you actually just compile a new scripting language: your own python, which knows about your stuff. This seems a bit more involved.

However, I enjoy Python a lot more, so it may be worth it if I can get the pipeline down.
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
Frozelar
Retired Screamer
Posts: 5
Joined: 12 years ago
Location: The Place You Wish You Were

Re: The Thread for Programming

Post by Frozelar »

Honestly, before I started teaching myself C++, with all the stuff I had been hearing about "C++ is so unnecessarily huge" I was preparing myself to spend years before being able to use it relatively effectively, when in reality it only took about 2 years before I was able to be okay at using it. Then I was pleasantly surprised. Although I think it's neat how there's so much other stuff in C++ besides the common things that I could spend another few years learning it if I wanted.
EDIT: Probably even longer than that actually, especially considering all the updates that are being developed, and external tools and everything.
Last edited by Frozelar 9 years ago, edited 1 time in total.
User avatar
docopoper
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non pharetra enim, nec maximus odio.
Posts: 78
Joined: 12 years ago
First name: Shane Farrell
Pronouns: they/he
Location: Ireland

Re: The Thread for Programming

Post by docopoper »

Well if you want sandboxed Python; pypy has a version of it. You just call the pypy sandbox as a separate process (maybe thread? not sure) and I think you can completely virtualise it. There seems to be a linux version of it on the pypy website, but it says it's portable in the docs so I'm confused as to where the other versions are. I would really like to get it working though, I've cool ideas for what to do with it.
The first thing I would do with infinite power would be to make myself a cave where I could look at my shadow forever.

Image <- Go team Yeah Doctor Shemp.!
Image <- That's everyone being nice to me. ^^

I made a game called Utter Confusion! Play it! :D
It's a lot of fun and has been incredibly popular at every indie game dev party I've brought it to.
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

Well, what I'm looking for is the ability to extend C++ types into Python, as opposed to simply routing calls from a python script that knows nothing about the C++ side. Similar to what Rena's doing with Lua:

Code: Select all

e = game:createEntity()
rend = e:addCircleRenderer()
These Lua lines end up creating native objects in the programmer's control.

But I might be totally misunderstanding. I'm admittedly pretty new to this stuff.
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
Alice
Posts: 2367
Joined: 12 years ago
Pronouns: Girl person
Location: Wonderland

Re: The Thread for Programming

Post by Alice »

Image
What in the world happened with the notifications for this thread?
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

RenaBeach wrote:i wrapped those with swig

it was pretty easy to set up (swig just outputs a C/C++ source file that wraps your C/C++ types/functions for lua) - then you just link against it, or compile it as a dll and load it at runtime

i don't think lua really knows anything about the types - it just creates tables with pointers to wrapper functions that can be called

swig supports python too btw (and many other embeddable languages)
Yeah but Lua has an entire API for its virtual machine that you can use to set up your bindings. Swig is just doing that for you.

Though I'm curious about the Python support. I'll have to check that out.
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
docopoper
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla non pharetra enim, nec maximus odio.
Posts: 78
Joined: 12 years ago
First name: Shane Farrell
Pronouns: they/he
Location: Ireland

Re: The Thread for Programming

Post by docopoper »

Most of the standard library functions in Python are written in C and Python has a CTypes module that lets you work with C style variables for dealing with C (and presumably C++) libraries. It sounds like you want to embed Python in C++ instead of making a library. I'm not sure how that would work, you probably can do it; but I've never looked into it.

Also for some reason I couldn't post for a while last night ,though it looks like it went through at least once (or duplicate posts got removed). So the notification spam is probably me trying to post multiple times.
The first thing I would do with infinite power would be to make myself a cave where I could look at my shadow forever.

Image <- Go team Yeah Doctor Shemp.!
Image <- That's everyone being nice to me. ^^

I made a game called Utter Confusion! Play it! :D
It's a lot of fun and has been incredibly popular at every indie game dev party I've brought it to.
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

Cause I was confused at first and thought I had made it private or something and that list was people who could see it and then I realized I didn't or something and didn't remove you from the list.
Image
Image
Image
Image
Image
Image
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

Yeah, I got the student pack a while back.

I'm not really worried about making a private repo at the moment cause if somebody really wanted to steal Isaac Bum Simulator, it wouldn't be the end of the world.
Image
Image
Image
Image
Image
Image
User avatar
lukaramu
not lukaramu
Posts: 0
Joined: 11 years ago
First name: not lukaramu
Location: the place where i live

Re: The Thread for Programming

Post by lukaramu »

It's not like it's anything secret that took you months to figure out, so...
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

Hey man, Isaac Bum Simulator has some top-tier code.
Image
Image
Image
Image
Image
Image
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

Horikawa Otane wrote:Playing around with javascript...

This code works:

Code: Select all

pies = 60;
ǃpies = 50;
while(ǃpies < pies) {
	console.log(ǃpies);
	ǃpies = ǃpies + 1;
}
console.log(!pies);
This code outputs...

Code: Select all

50
51
52
53
54
55
56
57
58
59
false 
Programming is weird.

Code: Select all

ǃpies = 50
I just read the wiki article on Javascript identifier syntax, and I still have no idea what this is doing. Is it nonstandard? That would explain everything.
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

Horikawa Otane wrote:
WhattayaBrian wrote:I just read the wiki article on Javascript identifier syntax, and I still have no idea what this is doing. Is it nonstandard? That would explain everything.
I've updated it with python doing the same thing. It seems to only like outputting in loops.

Code: Select all

C:\Users\Hawk>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> !pies = 50
  File "<stdin>", line 1
    !pies = 50
    ^
SyntaxError: invalid syntax
I can't get past defining it in the first place. (This is expected behavior.)

Edit: Wait, are you using a non-English locale? Like, for example, when you're in japanese, your backslashes become the Yen symbol. Are you seeing an exclamation point in these examples or something else?
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
lukaramu
not lukaramu
Posts: 0
Joined: 11 years ago
First name: not lukaramu
Location: the place where i live

Re: The Thread for Programming

Post by lukaramu »

I'm currently dabbling in Lambda calculus and the Hindley-Milner type system and maybe even implementing a type checker (but just maybe)
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

I made a thing for an assignment.
I think it all works?
Since it's not mentioned in the program, the dna.txt file contains a 444*8 characters. First 2 are person A's genes, next 2 are person B's genes, etc. So 2 genes each from 4 people. You basically had to use those to tell if anybody is related (if they share a gene they're related) and if any genes are sickle.
http://pastebin.com/ubkTijaJ

Also the function names are pretty stupid but I have no idea about any of this stuff other than what was mentioned in the assignment, so I just kind of went with what I knew.
Image
Image
Image
Image
Image
Image
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

I know nothing about enums and I'm sure I could learn and I probably will soon but for the sake of this assignment, that was never covered so *fart*
RenaBeach wrote:also AreRelated should obviously return bool
That's just awful function naming, haha
And I mean, the function itself basically does nothing other than pass those into another function which IS a bool (SameGene) so it kind of is other than the fact that it isn't!
RenaBeach wrote:
return "normal"; //the person is normal
ableist :(
Hahaha, yeah I felt weird putting that but it's literally what the assignment said!!
Prof. Air Check wrote:Create a report, called DNAanalysis.txt, that indicates whether each person
is anemic, a carrier, or normal. For example,
Person X is anemic.
Person Y is normal.
Person Z is a carrier.
Image
Image
Image
Image
Image
Image
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

Oh yeah, that would probably be a lot cleaner than a bunch of ||'s.
I'll add that.

THANK
Image
Image
Image
Image
Image
Image
User avatar
WhattayaBrian
Posts: 239
Joined: 9 years ago

Re: The Thread for Programming

Post by WhattayaBrian »

what rena no

no
If you read this post and thought "Wow, what a swell guy, I sure would like to hear his voice and also watch videogames?" then do I have a link for you.

Current Game: Distorted Travesty 3
User avatar
ano0maly
Discord User
Posts: 2947
Joined: 12 years ago

Re: The Thread for Programming

Post by ano0maly »

I wanna do IT
User avatar
Ashan
The world has become a place
Posts: 2825
Joined: 14 years ago
Location: Canada
https://ashan.talkhaus.com/

Re: The Thread for Programming

Post by Ashan »

I had a CS lab today and I only remembered it last night, and I was all worried because there was this optional thing last week to "practise" for it, and I kinda skimmed it and got completely lost (it was like some weird formula you were supposed to implement in like, a fake web search algorithm and their explanation made no sense) so I was expecting a really hard test.

It ended up being super easy. Take in an array of 10 integers, print out the array in reverse order, and then print out the sum of the odd integers.
No idea why their practice thing was so complicated.
Image
Image
Image
Image
Image
Image
User avatar
lukaramu
not lukaramu
Posts: 0
Joined: 11 years ago
First name: not lukaramu
Location: the place where i live

Re: The Thread for Programming

Post by lukaramu »

Ashan wrote:I had a CS lab today and I only remembered it last night, and I was all worried because there was this optional thing last week to "practise" for it, and I kinda skimmed it and got completely lost (it was like some weird formula you were supposed to implement in like, a fake web search algorithm and their explanation made no sense) so I was expecting a really hard test.

It ended up being super easy. Take in an array of 10 integers, print out the array in reverse order, and then print out the sum of the odd integers.
No idea why their practice thing was so complicated.
Ahh the beauty of Haskell:

Code: Select all

doStuff :: (Show a, Integral a) => [a] -> IO ()
doStuff i = do
    sequence_ . map (putStrLn . show) . reverse $ i
    putStrLn . show . sum . filter odd $ i
I love that language <3
Post Reply