my question is if there is a way to go to a specific line in the console window, delete that line, and redraw it. that way i could check if something changed and update only that line.
using windows and visual basic
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
mustache
Switzerland309 Posts
my question is if there is a way to go to a specific line in the console window, delete that line, and redraw it. that way i could check if something changed and update only that line. using windows and visual basic | ||
Sub40APM
6336 Posts
On December 04 2012 06:48 Blisse wrote: For example, if you call lower() on a string, then you check if the string has any uppercase letters. It even sounds redundant, no? as how can a lower cased string have uppercase letters anyways? I agree with most of your post but must come to his defense. If you look back to his code, while he converts the input string into lower and does stuff to it, his check on Uppercase applies to the original input string, whatever it may be. | ||
Arnstein
Norway3381 Posts
| ||
KaiserJohan
Sweden1808 Posts
Also what good free IDEs are there for php? | ||
AmericanUmlaut
Germany2577 Posts
On December 05 2012 19:47 KaiserJohan wrote: Also what good free IDEs are there for php? I use NetBeans for PHP and it works very well. | ||
KaiserJohan
Sweden1808 Posts
| ||
Kambing
United States1176 Posts
On December 05 2012 17:41 ghrur wrote: Hi guys, So next semester, I will be learning Python as part of a Comp Sci class I'll be taking. At the end of the class, we'll have to make a project primarily in Python. I've heard about this from my friends who're taking it now, so I've started contemplating the project. One of the thoughts I had was making an AI of sorts to play BW. It'd probably work through BWAPI. The problem is, a lot of my friends also say Python is too slow to be able to make the calculations for a game AI. Anyway, I'd just like some opinions on if it'd be possible to build a BW AI-bot in python. Thanks! It's perfectly reasonable; you aren't going to be building anything crazy performance-demanding. The only catch is that the BWAPI library is written in C++ so you would need to understand how to interop with C++ code from Python. Luckily, someone's already written Python bindings against BWAPI, so you don't even need to worry about that: http://code.google.com/p/bwapi/ http://code.google.com/p/pybw/ | ||
Blisse
Canada3710 Posts
On December 05 2012 17:45 mustache wrote: I'm programming a small snake game in C that runs in the console window. right now it clears and redraws the entire screen every time the snake moves 1 increment. this make the bottom of the screen start flickering because the redraw at the bottom takes longer than the top. my question is if there is a way to go to a specific line in the console window, delete that line, and redraw it. that way i could check if something changed and update only that line. using windows and visual basic I came across the same problem before. I knew this ability existed, because if you've used a lot of terminal installers, they often have a static download bar. However, I never found out how to do this. I would appreciate an answer to this problem as well, even though I've moved on. On December 05 2012 18:25 Sub40APM wrote: Show nested quote + On December 04 2012 06:48 Blisse wrote: For example, if you call lower() on a string, then you check if the string has any uppercase letters. It even sounds redundant, no? as how can a lower cased string have uppercase letters anyways? I agree with most of your post but must come to his defense. If you look back to his code, while he converts the input string into lower and does stuff to it, his check on Uppercase applies to the original input string, whatever it may be. Ooops. XD Strange that I missed that, though that would be another sample of redundancy, for this case. ![]() Actually, now I'm deciding if it was wrong to get the Pig Latin of the lowercased word, though I'm not sure how abbreviations and proper nouns should be handled, because the words that would be created wouldn't be real words (though it's never a real word anyways). | ||
CecilSunkure
United States2829 Posts
On December 05 2012 17:41 ghrur wrote: Hi guys, So next semester, I will be learning Python as part of a Comp Sci class I'll be taking. At the end of the class, we'll have to make a project primarily in Python. I've heard about this from my friends who're taking it now, so I've started contemplating the project. One of the thoughts I had was making an AI of sorts to play BW. It'd probably work through BWAPI. The problem is, a lot of my friends also say Python is too slow to be able to make the calculations for a game AI. Anyway, I'd just like some opinions on if it'd be possible to build a BW AI-bot in python. Thanks! A lot of your friends say Python is too slow for AI calculations? Sigh... A lot of your friends like to make assumptions without testing them. Python is perfectly fine for scripting AI. Your friends don't know what they're talking about. On December 05 2012 17:45 mustache wrote: I'm programming a small snake game in C that runs in the console window. right now it clears and redraws the entire screen every time the snake moves 1 increment. this make the bottom of the screen start flickering because the redraw at the bottom takes longer than the top. my question is if there is a way to go to a specific line in the console window, delete that line, and redraw it. that way i could check if something changed and update only that line. using windows and visual basic That's weird, are you multi-threading at all? That sounds like screen tearing where you're calling WriteConsoleOutput too quickly. Are you at least double buffering? Here's a couple links, which should be way more than enough information for you to fix this: http://cecilsunkure.blogspot.com/2011/11/windows-console-game-setting-up-window.html http://cecilsunkure.blogspot.com/2012/07/windows-console-game-ascii-engine.html | ||
mustache
Switzerland309 Posts
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch | ||
Bigpet
Germany533 Posts
On December 06 2012 03:24 mustache wrote: + Show Spoiler +
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch I don't know about the performance characteristics of system("cls") but you shouldn't printf() every single charater. You flush way too often that way. I'd advise you sprintf() a whole frame and just call printf() once you constructed the whole frame. | ||
Deleted User 101379
4849 Posts
On December 06 2012 03:24 mustache wrote: + Show Spoiler +
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch It's not possible in default C as far as i remember, though there are libraries for that. From a quick google, http://www.projectpluto.com/win32a.htm should work. I haven't tried it though since most of my C development was under linux where we had ncurses (which is not available for windows). | ||
Blisse
Canada3710 Posts
On December 06 2012 03:24 mustache wrote: + Show Spoiler +
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch Could you try building the array as a giant string, and then calling printf once on that entire string? That should solve it. @Cecil, I think he's writing a literal basic Console program, not a WIN32 application that interfaces with the Console. XD (even though it's kinda a subset of the other) | ||
RoyGBiv_13
United States1275 Posts
On December 06 2012 03:37 Blisse wrote: Show nested quote + On December 06 2012 03:24 mustache wrote: + Show Spoiler +
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch Could you try building the array as a giant string, and then calling printf once on that entire string? That should solve it. @Cecil, I think he's writing a literal basic Console program, not a WIN32 application that interfaces with the Console. XD (even though it's kinda a subset of the other) Yep, turns out this is one of those things Windows sucks at. This program would run as intended on a Unix box, because of how POSIX streams work. In any case, probably best practice to build your string first, then print it. It will make the code a bit more readable. Also, sorry that you have to deal with windows command line :/ | ||
CecilSunkure
United States2829 Posts
On December 06 2012 03:37 Blisse wrote: Show nested quote + On December 06 2012 03:24 mustache wrote: + Show Spoiler +
so im just cycling through my array and printing the values that are in that. but because the redrawing isnt fast enough the screen flickers(i assume) I've just started out programming in general so im not sure what multi threading or double buffering is.(so im probably not using it) ill check out the links in detail, but i'd like to program the game from start to finish by my self, to get more familiar with how things work. EDIT: i noticed in my first post i wrote im using visual basic. I meant visual studio c++, and im coding in C. ouch Could you try building the array as a giant string, and then calling printf once on that entire string? That should solve it. @Cecil, I think he's writing a literal basic Console program, not a WIN32 application that interfaces with the Console. XD (even though it's kinda a subset of the other) Oh I see, haha. Yeah just use a single printf call. The screen might "flicker" a little when the console scrolls. You can change the height in characters of the console so that it cannot scroll, if you wanted to. | ||
Recognizable
Netherlands1552 Posts
| ||
CecilSunkure
United States2829 Posts
On December 06 2012 03:52 Recognizable wrote: Could somebody explain to me whilst keeping terminology to a minimum what Indendation(Python) actually does. I keep coding and doing stuff but this is something I keep wondering about. My guess is that it separates things. It creates a new scope every time you indent. The scope closes when the indent is de-indented. | ||
mustache
Switzerland309 Posts
btw here the code if anyone's interested, and wants to see the flickering. + Show Spoiler + #include <stdio.h> | ||
Recognizable
Netherlands1552 Posts
def f(a,b): Am I right in saying that this works because return is in the same scope as C,D and so it can do something with these variables. If return wasn't indented it wouldn't be able to do that because it wasn't in the same scope and therefore can't do anything with those variables? | ||
CecilSunkure
United States2829 Posts
On December 06 2012 04:06 Recognizable wrote: I had to search for what scope is but I guess I understand it a bit better now. Why is this important? Why doesn't the computer understand what you are doing when you aren't indenting? def f(a,b): Am I right in saying that this works because return is in the same scope as C,D and so it can do something with these variables. If return wasn't indented it wouldn't be able to do that because it wasn't in the same scope and therefore can't do anything with those variables? Yeah that's right. When you make something within a scope, things outside of that scope cannot access the variable. It's not about the computer "knowing what you are doing", the Python interpreter is just following rules the creator laid out. Scoping is a good thing. If there was no scoping (or another way to say this is if there were only the global scope) then you could only have one name to one identifier. This gets annoying when you want to reuse an identifier.
You can see here I've already used two different identifiers, x and i. Luckily those two variables are within the scope of the for loops, otherwise I'd have to use a different variable name for each loop. | ||
| ||
![]() StarCraft 2 StarCraft: Brood War Counter-Strike Other Games summit1g7478 tarik_tv3691 Grubby2272 FrodaN2117 Sick355 C9.Mang0195 ViBE194 shahzam181 ToD175 Day[9].tv91 Mew2King48 PPMD31 Organizations
StarCraft 2 • RyuSc2 StarCraft: Brood War![]() • musti20045 ![]() • IndyKCrew ![]() • Migwel ![]() • sooper7s • AfreecaTV YouTube • intothetv ![]() • Kozan • LaughNgamezSOOP Dota 2 League of Legends Counter-Strike Other Games |
Replay Cast
LiuLi Cup
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
Big Brain Bouts
Iba vs GgMaChine
TriGGeR vs Bunny
Reynor vs Classic
Serral vs Clem
BSL Team Wars
Team Hawk vs Team Dewalt
BSL Team Wars
Team Hawk vs Team Bonyth
Code For Giants Cup
SC Evo League
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
Maestros of the Game
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[BSL 2025] Weekly
[ Show More ] SC Evo League
Maestros of the Game
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
Team Bonyth vs Team Sziky
BSL Team Wars
Team Dewalt vs Team Sziky
Monday Night Weeklies
Replay Cast
Sparkling Tuna Cup
LiuLi Cup
Replay Cast
The PondCast
RSL Revival
Maru vs SHIN
MaNa vs MaxPax
|
|