• What Do You Need Help With? V6
    7,544 replies, posted
Actually, how would i set a timers interval to 0(so it doesn't tick) in c#? I can't use timer.Stop(); If there is no other way, I'll just set it to a big value.
Hey, can't wrap my head around sorting maps in Clojure I have a sorted-map where the key/value pair looks like [6 6 6] {fitness: 6 :last 5} And I want to sort it by fitness, any idea? I've looked at sort, sort-by, sorted-map-by, etc but can't get anything working yet.
[QUOTE=NixNax123;46036996]I think I might try making connect 4 with SP mode with a simple AI/MP mode! Thanks![/QUOTE] What API would anyone recommend for doing such a project? I was thinking SFML because I'm comfortable with that, but I know it's made for C++, and I'd rather stick with Java because that's what my current course is taught it and I don't want to confuse myself with exams.
[QUOTE=blacksam;46013102]Is there an easy way to convert a huge hex dump's values into ascii? [editline]18th September 2014[/editline] I am currently fighting with the LC3 simulator in our class. Using this book, [url]http://www.amazon.com/Introduction-Computing-Systems-gates-beyond/dp/0072467509[/url] The struggle is real.[/QUOTE] If I understand the question correctly, you could parse each digit from right to left, calculate those based on 10^n, convert them to decimal, and convert the decimal to ascii? EDIT: my code is really sloppy cause it's just a proof of concept [code]Dim Shared STRINGBUFFER(32,100) As String Dim Shared FINALOUTPUT(32,100) As String Dim Shared INTEGERBUFFER(32,100) As Integer Dim Shared LINECOUNTER As Integer = 0 Dim Shared LONGESTSTRING As Integer Declare Sub OPENTEXTFILE Declare Sub CONVERTTODECIMAL Declare Sub CONVERTTOASCII OPENTEXTFILE() CONVERTTODECIMAL() CONVERTTOASCII() Sleep Sub OPENTEXTFILE Open "HEX.TXT" For Input As #1 Dim CURRENTLINE As String While Not Eof(1) Line Input #1,CURRENTLINE If Len(CURRENTLINE)/3 > LONGESTSTRING Then LONGESTSTRING = Len(CURRENTLINE)/3 EndIf For Q As Integer = 0 To (Len(CURRENTLINE)/3) STRINGBUFFER(Q,LINECOUNTER) = Mid(CURRENTLINE,(Q*3)-2,2) 'Locate(Q,LINECOUNTER) 'Print STRINGBUFFER(Q,LINECOUNTER) Next LINECOUNTER+=1 Wend End Sub Sub CONVERTTODECIMAL For I As Integer = 0 To LINECOUNTER-1 For Q As Integer = 0 To LONGESTSTRING For P As Integer = 0 To 1 Select Case UCase(Mid(STRINGBUFFER(Q,I),2-P,1)) Case "A" INTEGERBUFFER(Q,I)+=10*(16^P) Case "B" INTEGERBUFFER(Q,I)+=11*(16^P) Case "C" INTEGERBUFFER(Q,I)+=12*(16^P) Case "D" INTEGERBUFFER(Q,I)+=13*(16^P) Case "E" INTEGERBUFFER(Q,I)+=14*(16^P) Case "F" INTEGERBUFFER(Q,I)+=15*(16^P) CASE Else INTEGERBUFFER(Q,I)+=ValInt(Mid(STRINGBUFFER(Q,I),2-P,1))*(16^P) End Select Next Next Next End Sub Sub CONVERTTOASCII For I As Integer = 0 To LINECOUNTER-1 For Q As Integer = 0 To LONGESTSTRING FINALOUTPUT(Q,I) = Chr(INTEGERBUFFER(Q,I)) Locate I+1,Q Print FINALOUTPUT(Q,I) Next Next End Sub [/code] but the output is more or less correct this was the input [code]57 65 20 74 68 65 20 70 65 6f 70 6c 65 20 6f 66 0d 0a 74 68 65 20 55 6e 69 74 65 64 20 53 74 61 74 65 73 2c 0d 0a 69 6e 20 6f 72 64 65 72 20 74 6f 20 66 6f 72 6d 0d 0a 61 20 6d 6f 72 65 20 70 65 72 66 65 63 74 20 75 6e 69 6f 6e 2c 0d 0a 65 73 74 61 62 6c 69 73 68 20 6a 75 73 74 69 63 65 2c 0d 0a 69 6e 73 75 72 65 20 64 6f 6d 65 73 74 69 63 0d 0a 74 72 61 6e 71 75 69 6c 69 74 79 2c 20 70 72 6f 76 69 64 65 0d 0a 66 6f 72 20 74 68 65 20 63 6f 6d 6d 6f 6e 0d 0a 64 65 66 65 6e 73 65 2c 20 70 72 6f 6d 6f 74 65 0d 0a 74 68 65 20 67 65 6e 65 72 61 6c 20 77 65 6c 66 61 72 65 2c 0d 0a 61 6e 64 20 73 65 63 75 72 65 20 74 68 65 0d 0a 62 6c 65 73 73 69 6e 67 73 20 6f 66 20 6c 69 62 65 72 74 79 0d 0a 74 6f 20 6f 75 72 73 65 6c 76 65 73 20 61 6e 64 0d 0a 6f 75 72 20 70 6f 73 74 65 72 69 74 79 2c 20 64 6f 0d 0a 6f 72 64 61 69 6e 20 61 6e 64 20 65 73 74 61 62 6c 69 73 68 0d 0a 74 68 69 73 20 43 6f 6e 73 74 69 74 75 74 69 6f 6e 20 66 6f 72 0d 0a 74 68 65 20 55 6e 69 74 65 64 20 53 74 61 74 65 73 20 6f 66 20 41 6d 65 72 69 63 61 2e [/code] and this was the output [IMG]http://i.imgur.com/L36PQeH.png[/IMG] I don't know if that was not at all what you were looking for, but I more or less completed MY goal
[QUOTE=NixNax123;46040675]What API would anyone recommend for doing such a project? I was thinking SFML because I'm comfortable with that, but I know it's made for C++, and I'd rather stick with Java because that's what my current course is taught it and I don't want to confuse myself with exams.[/QUOTE] Any popular library in existence has bindings for everything, especially Java. SFML in particular has [url=http://jsfml.org/]official Java bindings[/url].
[QUOTE=ECrownofFire;46041516]Any popular library in existence has bindings for everything, especially Java. SFML in particular has [url=http://jsfml.org/]official Java bindings[/url].[/QUOTE] Ooooh! Thanks! I'll get started then! This is going to be my first big project. [editline]21st September 2014[/editline] Does anyone have any guides/tutorials on how to make a good class structure for a simple game like this? On projects like these I always get confused on how to start.
I just want a diagram of all my classes and how they should communicate, and then I'll be able to create those classes.
I'm making a small thing with PyQT, what is a tutorial that shows good general practices? The examples work, but do they promote good design patterns? What are the bare bones that any (non-example) application should have? This is my code currently, it seems like a mess: [code] class MainWindow(QtGui.QWidget): #Logic object ExSess=ExerciseSession() def __init__(self): super(MainWindow, self).__init__() self.initUI() def loadData(self,filename): if len(filename)!=0: self.ExSess.LoadExercises(filename) if self.ExSess.dataLoaded: self.writeToLog('Successfully loaded ' + str(self.ExSess.getDictSize()) + ' words from \" ' + filename + ' \" ') self.writeToLog('========================================') self.showExercise() else: self.writeToLog('Failed to load ' + '\"' + filename + '\"') else: self.writeToLog('No command line input file supplied. Please restart the application.') def initUI(self): #Main window self.setWindowTitle('Vocabulary Exercise') self.setGeometry(300, 300, 400, 300) #Log #!!! WHY SELF? WHY HERE??!!! self.outputLog = QtGui.QTextEdit() self.outputLog.setReadOnly(True) #User Input Line self.lineEdit=QtGui.QLineEdit() #Submit Button sButton=QtGui.QPushButton() sButton.setText('Submit') sButton.setToolTip('Submit Answer (Enter)') sButton.clicked.connect(self.processUserInput) #VBox vbox=QtGui.QVBoxLayout(self) vbox.setGeometry(self.frameGeometry()) vbox.addWidget(self.outputLog) vbox.addWidget(self.lineEdit) vbox.addWidget(sButton) #Signal connections self.lineEdit.setFocus() self.show() def writeToLog(self,istring): self.outputLog.append(istring) def getUserInput(self): user_input=self.lineEdit.text() return user_input def showExercise(self): self.writeToLog(self.ExSess.getExercise()) #Better split this into gathering and processing the input! def processUserInput(self): if self.ExSess.ex_no==(self.ExSess.ex_amount-1): self.writeToLog('Done! Resetting score...') user_input=str(self.lineEdit.text()) self.outputLog.append(user_input) self.lineEdit.setText('') self.lineEdit.setFocus() if self.ExSess.dataLoaded: if(self.ExSess.checkExercise(user_input)): self.writeToLog('Correct! Score: '+ str(self.ExSess.getScore()) + '/' + str(self.ExSess.getDictSize()) + '\n') else: self.writeToLog('Incorrect. Score: '+ str(self.ExSess.getScore()) + '/' + str(self.ExSess.getDictSize()) + '\n') self.ExSess.nextExercise() self.showExercise() def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Escape: self.close() elif e.key() == QtCore.Qt.Key_Enter: self.processUserInput() elif e.key() == QtCore.Qt.Key_Return: self.processUserInput() [/code]
So I want to translate that Hex Converter I just did into C. Problem is, I don't know exactly much about how Hex is used. I can read it just fine, but I don't really know much about it Anyways, if I needed to make an array buffer to hold all the hex values, how "wide" should I make it (i.e, when reading a file with hex values in it, how many hex values should it be able to read before making a new line)? I'm not worried about how "long" it needs to be cause I can just malloc that, but I don't know how long a chain of hex values can be before a new line is started
Ok, so i have two variables [CODE]int nuggets; int NuggetsPerSecond = 1; //NpS [/CODE] And i add NpS to nuggets every timer tick. The timer is set to one second. So as one second passes, it adds NpS to nuggets. But if you have larger NpS, it plainly goes from 0-20 if the NpS is 20. How would i do it so it goes smoothly from nuggets to NpS? No, i need that one-sec timer. It also should go from nuggets to NpS dependant on NpS size. I don't need code, you can explain it. But if it's easier to code, you can do whatever you want. (C#)
[QUOTE=EmilioGB;46048129]Ok, so i have two variables [CODE]int nuggets; int NuggetsPerSecond = 1; //NpS [/CODE] And i add NpS to nuggets every timer tick. The timer is set to one second. So as one second passes, it adds NpS to nuggets. But if you have larger NpS, it plainly goes from 0-20 if the NpS is 20. How would i do it so it goes smoothly from nuggets to NpS? No, i need that one-sec timer. It also should go from nuggets to NpS dependant on NpS size. I don't need code, you can explain it. But if it's easier to code, you can do whatever you want. (C#)[/QUOTE] [code] for(double t = 0; t < maxTime; t++) { for(int i = 0; i < nuggetsPerSecond; i++) { nuggets++; System.out.println(nuggets); } } [/code] should work
[QUOTE=NixNax123;46048359][code] for(double t = 0; t < maxTime; t++) { for(double i = 0.0; i < 1.0; i += 1/nuggetsPerSecond) { nuggets++; print(nuggets); } } [/code] should work[/QUOTE] It works, if the NpS is 1. But when i set it higher the program crashes.
[QUOTE=EmilioGB;46048516]It works, if the NpS is 1. But when i set it higher the program crashes.[/QUOTE] Make sure i is a double, or else it will round down to 0 and loop infinitely. Or use my edit, which makes it simpler, and less convoluted.
[QUOTE=NixNax123;46048758]Make sure i is a double, or else it will round down to 0 and loop infinitely.[/QUOTE] Yep, works. Thanks. But that's not what i meant. I did the same thing using timers, so : [CODE] private void mainTimer_Tick(object sender, EventArgs e) { nuggets++; mainTimer.Start(); } [/CODE] And this does the same thing. What i meant, is how to make it go 1,2,3,4 - 20; if NpS is 20. So i have the same timer code, but it immedietly adds 20. So it goes 0-20. The question is; how would i make it so it adds it smoothly; 1,2,3...15,16...19,20
[QUOTE=EmilioGB;46048873]Yep, works. Thanks. But that's not what i meant. I did the same thing using timers, so : [CODE] private void mainTimer_Tick(object sender, EventArgs e) { nuggets++; mainTimer.Start(); } [/CODE] And this does the same thing. What i meant, is how to make it go 1,2,3,4 - 20; if NpS is 20. So i have the same timer code, but it immedietly adds 20. So it goes 0-20. The question is; how would i make it so it adds it smoothly; 1,2,3...15,16...19,20[/QUOTE] [code] for(double t = 0; t < maxTime; t++) { for(int i = 0; i < nuggetsPerSecond; i++) { mainTimer.tick(); } } [/code] ? I don't quite understand the question.
[QUOTE=NixNax123;46048934][code] for(double t = 0; t < maxTime; t++) { for(int i = 0; i < nuggetsPerSecond; i++) { mainTimer.tick(); } } [/code] ? I don't quite understand the question.[/QUOTE] Ok, so this is the code i have now : [CODE] private void mainTimer_Tick(object sender, EventArgs e) { //Add nuggets nuggets += NpS; //Show number of nuggets nuggetsL.Text = "Nuggets " + nuggets.ToString(); //Start the timer again mainTimer.Start(); } [/CODE] And this, is an universal method for all upgrades, e.g. diggers, robots etc.(that dig for you) So every robot/digger, you gain NpS. In my old one, i had this : [CODE] private void button1_Click(object sender, EventArgs e) { if (goldNuggets >= NpSCost) { goldNuggets -= NpSCost; NpS = NpS * 2; NpSCost = NpSCost * 4; } } private void timer1_Tick(object sender, EventArgs e) { timer2.Interval = 10000 / diggers; try { timer3.Interval = 2500 / robots; } catch { timer3.Interval = 999999999; } npsL.Text = "NpS " + NpS; goldCount.Text = "Nuggets " + goldNuggets; robotC.Text = "Robots " + robots; upgradeNpS.Text = "Upgrade NpS(" + NpSCost + ")"; upgradeDiggers.Text = "Hire Diggers(" + diggersCost + ")"; upgradeRobot.Text = "Buy a Robot(" + robotCost + ")"; diggersC.Text = "Diggers " + diggers; timer1.Start(); this.Text = "Gold Diggers" + "|Nuggets " + goldNuggets.ToString(); } private void timer2_Tick(object sender, EventArgs e) { goldNuggets++; diggersC.Text = "Diggers " + diggers; timer2.Start(); } private void upgradeDiggers_Click(object sender, EventArgs e) { if (goldNuggets >= diggersCost) { goldNuggets -= diggersCost; diggers++; diggersCost = diggersCost * 2; } } private void timer3_Tick(object sender, EventArgs e) { goldNuggets += 5; timer3.Start(); } private void upgradeRobot_Click(object sender, EventArgs e) { if (goldNuggets >= robotCost) { goldNuggets -= robotCost; robots++; robotCost = robotCost * 2; } } [/CODE] And this is the code that handles all the upgrades, etc. It goes pretty smoothly, so it counts 1,2,3,4 etc. No matter what the NpS is, it still goes one by one. The NpS is 200, it still goes 1,2,3,4,5 The downside is, it has limits and isn't pretty clean. But with the code i have right now, let's say i have 200 NpS. So every second, it'll just go 0-200, 200-400, 400-600. Just plainly. What i want to achieve, is making it go smoothly. Like let's say mathf.slerp in Unity3D. So if i have 200 NpS, with the same code it goes 1,2,3,4,5,6...,50,51,52... 90,91,92... 192,193... 199, 200. So basically it adds ones dependant on NpS. Like Mathf.Slerp in Unity3D. If it's not achievable easily, or not the way i did it before, is there some library, that add's and element similar to Mathf.Slerp in Unity3D?
[QUOTE=NixNax123;46042843]I just want a diagram of all my classes and how they should communicate, and then I'll be able to create those classes.[/QUOTE] Does anyone have a guide or something on how to do make a diagram like this? I'm using Java, by the way.
Hmm, if anybody else still has this problemo, check this out [url]http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.mathhelper.lerp.aspx[/url]
Looking to jump into android development and because I already know web development (html, js etc) I figured there's not much point re learning java, so to anyone with experience with this is there a good framework available, or any I should steer clear from?
[QUOTE=z0mbify;46055364]Looking to jump into android development and because I already know web development (html, js etc) I figured there's not much point re learning java, so to anyone with experience with this is there a good framework available, or any I should steer clear from?[/QUOTE] I'm not sure if you mean a framework to make webapps or actual Java, if it's the latter you don't need a framework IMHO
What should I look into (Library? [Hope that's the right term])if I want to create a basic 2d game with python? Or is python not good for this sorta stuff. thanks
[QUOTE=Darwin226;46010824]Since you've done Lua you have an option to jump to a similar language and learn a few new concepts. This should probably feel pretty satisfying since you'll be able to grasp it easily. On the other hand, you can throw out everything you know and try something from the opposite end of the spectrum. With F# you would learn functional and object-oriented programming, and learn a very practical language that can use .NET. You'll have to google around for some tutorials since I haven't used any so I don't know what to recommend. With Haskell you would learn pure functional programming. Haskell is more elegant but more strict. [url]http://learnyouahaskell.com/[/url] is one of the best tutorials on anything I've ever read. Others have recommended some other languages that intersect with Lua more so they should be easier to pick up.[/QUOTE] I don't know why but F# (or other functional) is better choice from the beggining, because of fresh mindset. Either you learn functional from beginning (which will make you very skillful) or you learn imperative programming, which means you have very low chance of learning functional since it will be hard to learn functional mindset (if this makes sense). I hope I will be allowed to use F# for school since it is good shit for math and once it compiles, it works.
[QUOTE=z0mbify;46055364]Looking to jump into android development and because I already know web development (html, js etc) I figured there's not much point re learning java, so to anyone with experience with this is there a good framework available, or any I should steer clear from?[/QUOTE] There's Apache Cordova, which allows you to build web applications with enhanced native functionality on all major platforms. It essentially generates a web browser, but specific to your web app (without an address bar or anything like that) and with your logo etc., that exposes native features like the menu button or camera access to JavaScript. However, you still need to know web development practises for mobile platforms, and your webapp will still be a webapp - it won't let you build native UIs. And while you can try to copy Android's look and feel (or use something like jQuery Mobile), something's always going to feel off.
How can i start to write custom file types, i need to create a file with a header and body (i have no idea about encryptation, i just don't want to create txt files) I'm used to serialize data and write stuff using json, but...It's really easy to modify and i don't want that I would like to create custom files that contain info about how many elements do i have, classes and the name of items, description, and other data But i don't understand the concept of writing a byte sequel with a position
How to access Google Answers/Answer/Definition during search? so when you type anything like: What is apple, What is tree, What is TV, What is LCD, in google search engine, it gives you a small box with definition and clear description on top of results. What is that box called? and how can I access it specifically? For example if I have android app where user types "What is apple", how can I forward that question to Search Engine and return the answer defined by Google?
[QUOTE=DrTaxi;46057314]There's Apache Cordova, which allows you to build web applications with enhanced native functionality on all major platforms. It essentially generates a web browser, but specific to your web app (without an address bar or anything like that) and with your logo etc., that exposes native features like the menu button or camera access to JavaScript. However, you still need to know web development practises for mobile platforms, and your webapp will still be a webapp - it won't let you build native UIs. And while you can try to copy Android's look and feel (or use something like jQuery Mobile), something's always going to feel off.[/QUOTE] Thankyou, that helps a lot. I'm not fussed on how the ui looks, just easy access to native phone features
I am currently Programming c# in Visual Studio 2013. The program is ready, but people who want to test my program are getting this error. [code]The version of this file is not compatible with the version of Windows you are running. Check your computer's information to see whether you need an x86(32-bit) or x64(64-bit) version of the program, and then contact the software publisher.[/code] They are running Windows 7 64bit, as far as [I]they know[/I]. I am not getting the problem on my Windos8.1 machine. Project properties: Target Framework: .NET Framework 4.5 Platform Target: x86 Anyone know if this problem is related to how I compile the program?
[QUOTE=diwako;46064445] Anyone know if this problem is related to how I compile the program?[/QUOTE] Save yourself the trouble and just compile for AnyCPU, unless you are depending on some kind of native module
[QUOTE=DrTaxi;46024660]Shirky's teacher appears to be a moron.[/QUOTE] When I went through first year comp sci, we had to use [B]BluJ 2.0[/B] for our IDE.
[QUOTE=Goz3rr;46065319]Save yourself the trouble and just compile for AnyCPU, unless you are depending on some kind of native module[/QUOTE] Problem is, that program needs to run there. Basically I wrote it for the whole lot reason for it to run on those machines to check out Project revisions and export those to Excel files.
Sorry, you need to Log In to post a reply to this thread.