• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:25
CEST 08:25
KST 15:25
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 1 - Final Week6[ASL19] Finals Recap: Standing Tall12HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Esports World Cup 2025 - Brackets Revealed9Weekly Cups (July 7-13): Classic continues to roll2Team TLMC #5 - Submission extension2Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7
StarCraft 2
General
Who will win EWC 2025? RSL Revival patreon money discussion thread Esports World Cup 2025 - Brackets Revealed Team TLMC #5 - Submission extension The GOAT ranking of GOAT rankings
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event $5,100+ SEL Season 2 Championship (SC: Evo) WardiTV Mondays Sparkling Tuna Cup - Weekly Open Tournament
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
External Content
Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome
Brood War
General
BW General Discussion Flash Announces (and Retracts) Hiatus From ASL Starcraft in widescreen BGH Auto Balance -> http://bghmmr.eu/ A cwal.gg Extension - Easily keep track of anyone
Tourneys
Cosmonarchy Pro Showmatches [Megathread] Daily Proleagues CSL Xiamen International Invitational [BSL20] Non-Korean Championship 4x BSL + 4x China
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile CCLP - Command & Conquer League Project The PlayStation 5
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Stop Killing Games - European Citizens Initiative Russo-Ukrainian War Thread Summer Games Done Quick 2025! Things Aren’t Peaceful in Palestine
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 2024 - 2025 Football Thread NBA General Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 553 users

The Big Programming Thread - Page 50

Forum Index > General Forum
Post a Reply
Prev 1 48 49 50 51 52 1031 Next
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.
billy5000
Profile Blog Joined December 2010
United States865 Posts
April 17 2011 23:25 GMT
#981
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.
Tiger got to hunt, bird got to fly; Man got to sit and wonder, 'Why, why, why?' Tiger got to sleep, bird got to land; Man got to tell himself he understand. Vonnegut
RoTaNiMoD
Profile Blog Joined January 2004
United States558 Posts
April 18 2011 21:15 GMT
#982
On April 15 2011 14:04 Straught wrote:
Hey guys, I need help with something related with TI BASIC.
I made a quadratic equation solver, and made it so it could display non real answers, the problem is, when the root of a number isn't exact it will display it as decimal. Is there any way to make the program so it displays the answers as simplified roots?

Here's my program
+ Show Spoiler +

:a+bi
: Prompt A,B,C
:B²-4AC→D
:Disp (-B+√(D))/(2A)→Frac
:Disp (-B-√(D))/(2A)→Frac
:DelVar A
:DelVar B
:DelVar C
:DelVar D


Take this quadratic equation as an example:
4x²+4x+4=0

For example, I would like the answers of this equation to be displayed as this:
(-1+i√3)/2
(-1-i√3)/2

instead i get
-1/2+.866025403...
-1/2-.866025403...

(the ... actually appear in the calculator)
All help appreciated... thanks!


Straught:

You have three main issues here. First, you want to keep the i-part of your complex answers around. Second, you want to display solutions as roots instead of decimal expansions. And third, you want to display this as a string instead of something just evaluated by the calculator.

The first issue requires a branch depending on whether or not D is positive. If it's positive, no need to worry about i. If it's negative, make a note of it in a variable, multiply D by -1 for the rest of the program, and throw in the i's when you build the output.

The second issue requires testing if sqrt(D) is an integer number. I forget what built-in functions you have in BASIC for that, but I think there's an Int(x) function? Anyway test if D == Int(D) however you can. Make a note of D's integer-ness in a variable.

Now, third, you build the string. Output a left-parenthesis, then a minus sign, then B, then a plus sign, then, if D is an integer, D followed optionally by i, and if D is not an integer, D preceded optionally by i, then a right parenthesis, then a division sign, then 2A.

Happy coding!
SCbiff
Profile Joined May 2010
110 Posts
April 19 2011 20:12 GMT
#983
On April 16 2011 06:42 Qzy wrote:
What's the difference between Upper confidence tree and Monte-carlo tree search? Other than the UCB1-selection algorithm. Why do they refer to it as the "upper confidence tree", and not just "MCTS with another in-tree selection method"?

It makes no sense. Please help =).


I'm not sure I understand your question.

If your question is really "why is it named that?", then I would reply "Who knows?" or "What's in a name?" If I were to guess, I would say it's to differentiate the two in a way that is clear and unique. This isn't unusual in many scientific fields. Also, it could be that it's just deemed easier to deal with. It could be called MC-UCB, but that's not something you're probably going to have much luck understanding by itself. An upper confidence tree is something you can probably piece together just from knowing about MC trees and the UCB algorithm. Again though, this is all speculation. It's probably a lot like naming a star, first guy there gets to do whatever he wants.

If you're asking how the algorithms themselves differ, there's quite a few decent explanations a google away. I don't think this is what you are asking though, so I won't bother to link them unless you'd like me to.
R04R
Profile Joined March 2009
United States1631 Posts
Last Edited: 2011-04-23 05:44:36
April 23 2011 04:53 GMT
#984
Hey guys, I need some help. I have most of the body of my code done, but I can't figure out to make some things work. I added printfs to keep track of my data. Here's my code and here's the prompt

The problem I have is when I get an input of X in the scanf, my function within if(input == 'X') doesn't execute and instead continues asking for input values.

Also, I noticed another bug also where when it begins to scan for the next player's jersey number, it only takes in "1" and not both 1 and 8 to set as the input value. Although this is the input value and not the player value, when I do get to this point how do I make sure the scanf will take in both 1 and 8 to set as the next player's jersey number? /// Will this bug be fixed once my first bug is fixed since the scanf within the if(x == 1) asks for an integer to be scanned in?

An example of my output when I use Sample Input 2 within the prompt:
[spoiler]
[/spoiler]

Friend helped me. Thanks anyways TL.
ô¿ô
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
April 23 2011 19:15 GMT
#985
On April 18 2011 08:25 billy5000 wrote:
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.


Best way? --> get a Computer Science degree, pref. in sweden, we got really really good CS programs.

Hobby? google for some programming introduction/tutorials.

It's a question that has been posted a million times - check through this topic, you'll find an answer here.
England will fight to the last American
Aack
Profile Joined February 2011
Australia3 Posts
April 24 2011 14:59 GMT
#986
On April 24 2011 04:15 KaiserJohan wrote:
Show nested quote +
On April 18 2011 08:25 billy5000 wrote:
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.


Best way? --> get a Computer Science degree, pref. in sweden, we got really really good CS programs.

Hobby? google for some programming introduction/tutorials.

It's a question that has been posted a million times - check through this topic, you'll find an answer here.


Assuming you go the hobby route (which is a good way to evaluate if you really want to fly to sweden for a 3 year degree) - i would suggest googling 'Python tutorial' or similar.

Python is a great beginners language because its syntax is almost plain english and its very quick to setup and bang out an example program.
kuresuti
Profile Blog Joined December 2009
1393 Posts
April 24 2011 16:59 GMT
#987
On April 24 2011 23:59 Aack wrote:
Show nested quote +
On April 24 2011 04:15 KaiserJohan wrote:
On April 18 2011 08:25 billy5000 wrote:
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.


Best way? --> get a Computer Science degree, pref. in sweden, we got really really good CS programs.

Hobby? google for some programming introduction/tutorials.

It's a question that has been posted a million times - check through this topic, you'll find an answer here.


Assuming you go the hobby route (which is a good way to evaluate if you really want to fly to sweden for a 3 year degree) - i would suggest googling 'Python tutorial' or similar.

Python is a great beginners language because its syntax is almost plain english and its very quick to setup and bang out an example program.


I'm currently learning Python as I go with Project Euler and various internet resources. It's pretty fun and you get a grasp of some mathematics at the same time

Highly recommended!
sidesprang
Profile Joined January 2009
Norway1033 Posts
April 24 2011 17:05 GMT
#988
project euler is a good way to learn
Float like a butterfly, sting like a bee.
makesomenoiiise
Profile Joined March 2011
United Kingdom78 Posts
April 24 2011 17:54 GMT
#989
Tofucake, I am a 16 year old in secondary school (english equivalent of high school) and I'm trying to get into programming. Obviously I'm gonna take computer science at university, and I'm planning on getting a masters after that in Networking. How do I break into programming though? I try to learn a language, and I just can't seem to understand how to do it, I am missing basic knowledge like what Objects are, structures, those kinds of things. Obviously you need to be pretty good at Mathematics to programme, but that's no problem for me as I am an A* student in Maths. So, any advice on how to break into the basics, and then go onto learning a language?
Thanks in advance, assuming you are able to answer this
|MouzThorZain|DignitasNaniwa|DignitasSjow|EGIdra|mtwDimaga|TTWhiteRa|EGDeMuslim|
haduken
Profile Blog Joined April 2003
Australia8267 Posts
Last Edited: 2011-04-25 01:35:30
April 25 2011 01:31 GMT
#990
The starting level has nothing to do with math. At most you will need to understand a little bit of algebra and recursion.

Just do it step by step and learn all the simple concepts like variables, structures, loop, object oriented etc... it will click eventually that is if you don't give up...

Just write code, write a lot of it and read other's code and ask questions. There are no other ways. You won't be able to make cool shits in the near future.

However I do suggest you start with a language that is well established. When I started back in 2003, I waste a lot of time just trying to find materials.
Rillanon.au
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
Last Edited: 2011-04-25 01:41:21
April 25 2011 01:34 GMT
#991
what should I learn to be a webprogrammer?

I have good C++ and Java skill, and some script languege knowledge (python, lua)
no php though

edit:

I cant afford college or other courses
I started learning from w3schools.com, but its sooo much

any pointers, what should be the logical path to be a webprogrammer in 1-2 years?
And all is illuminated.
HowitZer
Profile Joined February 2003
United States1610 Posts
April 25 2011 01:44 GMT
#992
On April 25 2011 10:34 freelander wrote:
what should I learn to be a webprogrammer?

I have C++, Java, and some script languege knowledge (python, lua)
no php though


Try out Visual Web Developer by Microsoft. It's a free integrated development environment for developing asp.net applications. The backend code can be written in C# which is quite a bit like C++. ASP.NET is a very powerful tool for developing web applications. Remember that everything on the web ends up in html format.
Human teleportation, molecular decimation, breakdown and reformation is inherently purging. It makes a man acute.
Hoon
Profile Joined December 2010
Brazil891 Posts
April 25 2011 07:22 GMT
#993
It's 4am here and I have until 1pm to finish my task.
We have to make a game in C++ following a requirement table, and I got stuck with Method Overloading and Operator Overloading (2 operators overloaded required). <_<
I have no idea what/how to do Operator Overloading and Visual doesn't run the game with Method Overflow (Stack overflow fatal error).
Can anyone help me? D:

Thanks in advance.
SEn Fanclub: http://www.teamliquid.net/forum/viewmessage.php?topic_id=170834
japro
Profile Joined August 2010
172 Posts
Last Edited: 2011-04-25 08:59:45
April 25 2011 08:44 GMT
#994
On April 25 2011 16:22 Hoon wrote:
It's 4am here and I have until 1pm to finish my task.
We have to make a game in C++ following a requirement table, and I got stuck with Method Overloading and Operator Overloading (2 operators overloaded required). <_<
I have no idea what/how to do Operator Overloading and Visual doesn't run the game with Method Overflow (Stack overflow fatal error).
Can anyone help me? D:


It's kinda hard to help when you are not even telling us what kind of game you are making. A board game? Something arcadeish (Tetris, Snake...)?

Method/Function overloading is trivial, you just write multiple methods with the same name but different parameters.

For a board game you could for example do this:

void do_move(Move m) { ... } //do a single move
void do_move(Move m_array[], int n) { ... } //do n moves in m_array


For operator overloading you have to know which operator to overload. Again for a board game it could be useful to overload for example the "()" operator to access the board:


class Board {
private:
Square squares[8][8];
//...
public:
Square operator()(int i, int y) { return squares[i][j]; }
//...
}

//yo you can access the board like
Board game_board;

Square s = game_board(3,3);



Stack overflow usually means you have non terminating recursion.
shmay
Profile Blog Joined July 2004
United States1091 Posts
Last Edited: 2011-04-25 08:54:31
April 25 2011 08:53 GMT
#995
On April 25 2011 10:34 freelander wrote:
what should I learn to be a webprogrammer?

I have good C++ and Java skill, and some script languege knowledge (python, lua)
no php though

edit:

I cant afford college or other courses
I started learning from w3schools.com, but its sooo much

any pointers, what should be the logical path to be a webprogrammer in 1-2 years?


You're best off learning a web framework, like Django (Python), Ruby on Rails, or ASP.NET (etc). I personally work with Rails and definitely recommend it, but there are of course many good options out there. Basically -> do your research -> pick a framework/language -> buy/read a recommended book/tutorial on it -> start building apps -> learn as you go (ask questions on irc/stack overflow/hacker news). Learning html/css and eventually javascript (probably in the context of jQuery) are of course musts.

Django has excellent docs and Rails Tutorial is an excellent intro to Rails.
shmay
Profile Blog Joined July 2004
United States1091 Posts
April 25 2011 08:56 GMT
#996
On April 18 2011 08:25 billy5000 wrote:
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.


http://learnpythonthehardway.org/index
Hoon
Profile Joined December 2010
Brazil891 Posts
April 25 2011 09:24 GMT
#997
On April 25 2011 17:44 japro wrote:
Show nested quote +
On April 25 2011 16:22 Hoon wrote:
It's 4am here and I have until 1pm to finish my task.
We have to make a game in C++ following a requirement table, and I got stuck with Method Overloading and Operator Overloading (2 operators overloaded required). <_<
I have no idea what/how to do Operator Overloading and Visual doesn't run the game with Method Overflow (Stack overflow fatal error).
Can anyone help me? D:


+ Show Spoiler +
It's kinda hard to help when you are not even telling us what kind of game you are making. A board game? Something arcadeish (Tetris, Snake...)?

Method/Function overloading is trivial, you just write multiple methods with the same name but different parameters.

For a board game you could for example do this:

void do_move(Move m) { ... } //do a single move
void do_move(Move m_array[], int n) { ... } //do n moves in m_array


For operator overloading you have to know which operator to overload. Again for a board game it could be useful to overload for example the "()" operator to access the board:


class Board {
private:
Square squares[8][8];
//...
public:
Square operator()(int i, int y) { return squares[i][j]; }
//...
}

//yo you can access the board like
Board game_board;

Square s = game_board(3,3);




It's actually a 2D racing game.

Oh wow I didn't know that I could overload ().
It's gonna be really helpful, since I'm using a .txt to load the track.
Tyvm!

Stack overflow usually means you have non terminating recursion.


Visual accuses Stack Overload even when I access the same method only twice. I really don't know whats up, because it worked with Dev C++ on another project.
SEn Fanclub: http://www.teamliquid.net/forum/viewmessage.php?topic_id=170834
japro
Profile Joined August 2010
172 Posts
April 25 2011 09:38 GMT
#998
Maybe there is some sort of hidden recursion. Like you are creating an object of type B in the constructor of A and vice versa. But without actually seeing at least the code that produces the problem it's hard to tell.
Hoon
Profile Joined December 2010
Brazil891 Posts
April 25 2011 09:46 GMT
#999
On April 25 2011 18:38 japro wrote:
Maybe there is some sort of hidden recursion. Like you are creating an object of type B in the constructor of A and vice versa. But without actually seeing at least the code that produces the problem it's hard to tell.

Well, you were actually right.
I was calling the recursive function inside a while loop but I didn't notice it. lol
Now I just need to add that operator you just taught me, but I'm kinda lazy <_<
Ty again. :p
SEn Fanclub: http://www.teamliquid.net/forum/viewmessage.php?topic_id=170834
catamorphist
Profile Joined May 2010
United States297 Posts
April 25 2011 13:58 GMT
#1000
On April 25 2011 17:56 shmay wrote:
Show nested quote +
On April 18 2011 08:25 billy5000 wrote:
I'm very new to programming, and I want to know what would be the best way to start learning. I honestly have no idea what I'm going to use this knowledge for, but programming seems to become more and more useful in any career.

...and now that online gambling is officially illegal, I'm desperately looking for a new hobby.


http://learnpythonthehardway.org/index


This dude knows what's up (notwithstanding all the good advice earlier in the thread.)
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Prev 1 48 49 50 51 52 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 35m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 238
mcanning 42
StarCraft: Brood War
Zeus 1144
Noble 33
Bale 7
PianO 0
Dota 2
ODPixel398
NeuroSwarm111
canceldota0
League of Legends
JimRising 779
Counter-Strike
Stewie2K1137
Super Smash Bros
Mew2King114
Other Games
summit1g13069
WinterStarcraft337
Trikslyr39
SortOf18
Organizations
Other Games
gamesdonequick3179
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH391
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota213
League of Legends
• Rush2208
• Lourlo1592
Upcoming Events
Replay Cast
3h 35m
WardiTV European League
9h 35m
ShoWTimE vs sebesdes
Percival vs NightPhoenix
Shameless vs Nicoract
Krystianer vs Scarlett
ByuN vs uThermal
Harstem vs HeRoMaRinE
PiGosaur Monday
17h 35m
uThermal 2v2 Circuit
1d 9h
Replay Cast
1d 17h
The PondCast
2 days
WardiTV European League
2 days
Replay Cast
2 days
Epic.LAN
3 days
CranKy Ducklings
4 days
[ Show More ]
Epic.LAN
4 days
CSO Contender
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs Sziky
Dewalt vs Hawk
Hawk vs QiaoGege
Sziky vs Dewalt
Mihu vs Bonyth
Zhanhun vs QiaoGege
QiaoGege vs Fengzi
Sparkling Tuna Cup
5 days
Online Event
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Zhanhun
Dewalt vs Mihu
Hawk vs Sziky
Sziky vs QiaoGege
Mihu vs Hawk
Zhanhun vs Dewalt
Fengzi vs Bonyth
Liquipedia Results

Completed

2025 ACS Season 2: Qualifier
RSL Revival: Season 1
Murky Cup #2

Ongoing

JPL Season 2
BSL 2v2 Season 3
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
BSL20 Non-Korean Championship
Championship of Russia 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters

Upcoming

CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
2025 ACS Season 2
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
BSL Season 21
K-Championship
RSL Revival: Season 2
SEL Season 2 Championship
uThermal 2v2 Main Event
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.