(02-22-2016, 10:10 AM)IceStrike256 Wrote: [ -> ]This is my current assignment that im working on but I was gone for the last week of class so im not sure where im going wrong.
we are making are own dynamically allocated vector of ints using arrays. if anyone wanted to take a look I would be grateful.
Edit. Also the driver.h and driver.cpp were provided.
http://1drv.ms/1PQI9VQ
You still haven't mentioned what the issue is.
it was giving errors on data entry but found my mistake.
Petit Computer DSi SmileBASIC to be specific, basically it's a modified version of BASIC and it's one of the easiest programming languages you will ever use. It's running pretty dang slow. It's actually slower than Petit Computer DSi, and that's saying something, how the DS's little weak CPU is outdoing my i7 4790k. I thought an interpreter would be fast enough but it's becoming clear that it's not even sufficient to run games that utilized all of PTC's power. So as an example here's part of the code that handles IF THEN NEXT.
Code:
case 143: //IF (143 is the index of "IF", using a switch because I thought it would be faster than multiple if statements. It's really not that much faster.)
if (solve(SBarr[line + ++addline])){
//if the requirement is met
addline += 1;
if (SBarr[line + addline + 1][0] == '@'){
setline = Variable.FindVal(SBarr[line + addline + 1]);
if (setline == 0){ synerr = 1; ret = 3; }
addline = 0;
}
synerr = 0;
}
else
{//get to the end of the statement (or the ELSE)
int lineo = SBarrLine[line + addline];
while (lineo == SBarrLine[line + addline] && SBarr[line + addline] != "ELSE"){
addline++;
}
if (SBarr[line + addline] != "ELSE"){ addline--; }
else{
if (SBarr[line + addline + 1][0] == '@'){
setline = Variable.FindVal(SBarr[line + addline + 1]); synerr = 0;
if (setline == 0){ synerr = 1; ret = 3; }
addline = 0;
}
}
synerr = 0;
}
break;
Probably extremely confusing out of context, but you get it, all that garbage is going to be multitudes slower than if () {} else {}. So I want to take the approach of not interpreting it by taking
IF VAR == 5 THEN PRINT "Var equals 5" ELSE PRINT "Var does not equal 5"
and turning it into
if (VAR==5) { print("Var equals 5"); } else { print("Var does not equal 5"); }
doing that for every found command, writing it all down into some kind of text file and then compiling that file, then running it. The problem is I'm fairly new to c++, (this is actually the first thing I've made since I figured out how to write and read text files) and I do not know how to do that.
I found this
http://runtimecompiledcplusplus.blogspot.com/
But it gives no explanation on how to use it.
Here's my program btw to anyone that wanted to look at it, no source code, I figure it's not really worth figuring out git just yet.
http://smilebasicsource.com/forum?ftid=466&page=1
can't you use stuff like strncpy and other string manipulating functions to add change the casing and add the () & {} ?
SHIT,
i merged incorrectly and now the title is fucked <<
WHOOPS
EDIT : im guessing this was the title the thread used to have

Oh so this is where my topic went.
Anyway modifying strings is pretty simple and I can do that, it's compiling them in the application itself I don't know how to do.
Hey, so I'm building a minesweeper clone in python, no real reason than to work on programming and I was having a slight problem with tkinter or lambdas, I'm not sure which
Here is my current GUI code
https://gist.github.com/TechyZeldaNerd/a2d3f27fa9349c6ea7291477a00a2533
Currently, I'm creating plenty of buttons, each with a theoretically unique callback. The problem is that all the callbacks end up with the same parameters, the parameters of the last button (in this case, i = j = 15)
I suspect that it might be because of this line
Code:
tmp = tk.Button(text = 'x: ' + str(i) + " y: " + str(j), command = lambda: check(i,j))
I suspect the variables i and j in the lambda aren't evaluated when the buttons are created. Is there be a way to force them to be evaluated when I create the button, or will I have to work around this
Edit: Nevermind, python lambdas are late binding, I just had to create a copy of the variable in the lambda
Minesweeper doesn't seem to me to be the kind of thing that would benefit from lambdas. Remember that it's important to keep your code readable, even if it means you're missing out on using certain language features that might make things ever so slightly simpler.
Sometimes it can be fun to try a convoluted and unreadable solution to a problem. Assuming it's for fun and/or educational purposes, which I assume "no real reason than to work on programming" means (provided I correctly inferred that there's an "other" missing, as otherwise the sentence makes no sense), why not mess around with lambdas and practice using them?