Page 15 of 20
Re: The Thread for Programming
Posted: 11 Nov 2014, 19:42
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.

Re: The Thread for Programming
Posted: 11 Nov 2014, 21:11
by WhattayaBrian
That's because python is so easy. No one has any questions about it!
Re: The Thread for Programming
Posted: 11 Nov 2014, 21:22
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.
Re: The Thread for Programming
Posted: 11 Nov 2014, 21:26
by docopoper
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).
Re: The Thread for Programming
Posted: 11 Nov 2014, 21:38
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.
Re: The Thread for Programming
Posted: 11 Nov 2014, 22:42
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.
Re: The Thread for Programming
Posted: 12 Nov 2014, 00:29
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.
Re: The Thread for Programming
Posted: 12 Nov 2014, 01:22
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.
Re: The Thread for Programming
Posted: 12 Nov 2014, 01:35
by Alice

What in the world happened with the notifications for this thread?
Re: The Thread for Programming
Posted: 12 Nov 2014, 01:39
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.
Re: The Thread for Programming
Posted: 12 Nov 2014, 09:37
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.
Re: The Thread for Programming
Posted: 16 Nov 2014, 22:02
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.
Re: The Thread for Programming
Posted: 16 Nov 2014, 23:45
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.
Re: The Thread for Programming
Posted: 17 Nov 2014, 15:26
by lukaramu
It's not like it's anything secret that took you months to figure out, so...
Re: The Thread for Programming
Posted: 17 Nov 2014, 16:10
by Ashan
Hey man, Isaac Bum Simulator has some top-tier code.
Re: The Thread for Programming
Posted: 18 Nov 2014, 07:16
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.
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.
Re: The Thread for Programming
Posted: 18 Nov 2014, 07:23
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?
Re: The Thread for Programming
Posted: 18 Nov 2014, 20:43
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)
Re: The Thread for Programming
Posted: 18 Nov 2014, 20:48
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.
Re: The Thread for Programming
Posted: 18 Nov 2014, 21:17
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.
Re: The Thread for Programming
Posted: 18 Nov 2014, 21:24
by Ashan
Oh yeah, that would probably be a lot cleaner than a bunch of ||'s.
I'll add that.
THANK
Re: The Thread for Programming
Posted: 24 Nov 2014, 22:34
by WhattayaBrian
what rena no
no
Re: The Thread for Programming
Posted: 25 Nov 2014, 03:03
by ano0maly
I wanna do IT
Re: The Thread for Programming
Posted: 25 Nov 2014, 17:15
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.
Re: The Thread for Programming
Posted: 25 Nov 2014, 19:34
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