• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:24
CEST 08:24
KST 15:24
  • 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
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun5[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists19[ASL21] Ro16 Preview Pt1: Fresh Flow9
Community News
2026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid25
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid Maestros of the Game 2 announced
Tourneys
WardiTV Spring Cup 2026 GSL Season 1 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament INu's Battles#14 <BO.9 2Matches> GSL CK: More events planned pending crowdfunding
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
JaeDong's ASL S21 Ro16 Post-Review BW General Discussion Leta's ASL S21 Ro.16 review ASL21 General Discussion [ASL21] Ro8 Preview Pt1: Inheritors
Tourneys
[ASL21] Ro8 Day 2 [BSL22] RO16 Group Stage - 02 - 10 May [Megathread] Daily Proleagues [ASL21] Ro8 Day 1
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Daigo vs Menard Best of 10 Nintendo Switch Thread Dawn of War IV Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1445 users

The Big Programming Thread - Page 427

Forum Index > General Forum
Post a Reply
Prev 1 425 426 427 428 429 1032 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.
Shikada
Profile Joined May 2012
Serbia976 Posts
January 15 2014 00:07 GMT
#8521
Just to make what sluggaslamoo said more clear, while he says that polling similar to this is used in most frameworks, don't think that a serious, or let alone industry strength framework, would ever literally use a construct like this. The while loop would never have an empty body, at least the thread would be put to sleep, to not waste CPU resources.
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
January 15 2014 00:29 GMT
#8522
On January 15 2014 08:43 Zocat wrote:
It's called busy spin / spin lock afaik.
Overall you should avoid using it, since it just burns the CPU.

I think one thing were you can use it was when you only have to wait for very very short amount of times where implementing events would introduce a larger overhead. (No idea if that's true though, never used it)


Its called a latch function, its used a lot more than you think.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
January 15 2014 00:35 GMT
#8523
On January 15 2014 09:29 sluggaslamoo wrote:
Show nested quote +
On January 15 2014 08:43 Zocat wrote:
It's called busy spin / spin lock afaik.
Overall you should avoid using it, since it just burns the CPU.

I think one thing were you can use it was when you only have to wait for very very short amount of times where implementing events would introduce a larger overhead. (No idea if that's true though, never used it)


Its called a latch function, its used a lot more than you think.


Wikipedia seems to suggest "busy-waiting or spinning".
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
Last Edited: 2014-01-15 01:51:03
January 15 2014 01:48 GMT
#8524
On January 15 2014 09:35 darkness wrote:
Show nested quote +
On January 15 2014 09:29 sluggaslamoo wrote:
On January 15 2014 08:43 Zocat wrote:
It's called busy spin / spin lock afaik.
Overall you should avoid using it, since it just burns the CPU.

I think one thing were you can use it was when you only have to wait for very very short amount of times where implementing events would introduce a larger overhead. (No idea if that's true though, never used it)


Its called a latch function, its used a lot more than you think.


Wikipedia seems to suggest "busy-waiting or spinning".


Oops brain fart, you pass in the latch function to the spinlock/poller/whateveryouwannacallit.

The proper way to do it would be to create a function that takes a latch function that returns a promise.

An example of this is the "waitsFor" function in Jasmine. Its really just an asynchronous while loop that takes functions as parameters.

http://pivotal.github.io/jasmine/#section-24
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
Pucca
Profile Blog Joined January 2012
Taiwan1280 Posts
January 15 2014 13:35 GMT
#8525
I'm working on a C++ program, I'm a noob so I was wondering if anyone could give some tips on my logic.

StarCraft 1 like any program has independent data strings for each piece of information in the game. My goal is to read this data string and place it into a constantly updating .txt file.

There are two data strings I have, Total Score of Player A and Total Score of Player B. I want to combine the two. So like Player A is 15 Player B is 14 the output becomes 29 places into the text file.

So my logic is

Data stream of Player A is A
Data stream of Player B is B
ReadProcessData of A
ReadProcessData of B
combine? (I don't know C++ function to add) A and B to result in C
Fstream C to TeamA.txt **refresh every .2sec**

As long as the data streams are consider variables you can add them no? Any assistance is appreciate, if you'd like to help me please PM me. Thanks.
Master Chief
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-01-15 13:53:46
January 15 2014 13:52 GMT
#8526
I can't help with C++ but variables cannot be added if there is no + operator implementation. Example in Java (generics, called template in C++):


T t;
K k;

System.out.println(t + k);


Let me know if I am mistaken, but I wasn't able to do this once.
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
January 15 2014 14:06 GMT
#8527
On January 15 2014 22:35 Pucca wrote:
I'm working on a C++ program, I'm a noob so I was wondering if anyone could give some tips on my logic.

StarCraft 1 like any program has independent data strings for each piece of information in the game. My goal is to read this data string and place it into a constantly updating .txt file.

There are two data strings I have, Total Score of Player A and Total Score of Player B. I want to combine the two. So like Player A is 15 Player B is 14 the output becomes 29 places into the text file.

So my logic is

Data stream of Player A is A
Data stream of Player B is B
ReadProcessData of A
ReadProcessData of B
combine? (I don't know C++ function to add) A and B to result in C
Fstream C to TeamA.txt **refresh every .2sec**

As long as the data streams are consider variables you can add them no? Any assistance is appreciate, if you'd like to help me please PM me. Thanks.

Isn't this a very roundabout way of doing it? Isn't it better to parse the data from the processes into strings, then simply write these strings to the common file when they change?
synd
Profile Joined July 2011
Bulgaria586 Posts
Last Edited: 2014-01-15 14:21:04
January 15 2014 14:20 GMT
#8528
On January 15 2014 22:52 darkness wrote:
I can't help with C++ but variables cannot be added if there is no + operator implementation. Example in Java (generics, called template in C++):


T t;
K k;

System.out.println(t + k);


Let me know if I am mistaken, but I wasn't able to do this once.


cout << t + k << "\n";

....
profit?
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-01-15 14:50:53
January 15 2014 14:35 GMT
#8529
On January 15 2014 22:35 Pucca wrote:
I'm working on a C++ program, I'm a noob so I was wondering if anyone could give some tips on my logic.

StarCraft 1 like any program has independent data strings for each piece of information in the game. My goal is to read this data string and place it into a constantly updating .txt file.

There are two data strings I have, Total Score of Player A and Total Score of Player B. I want to combine the two. So like Player A is 15 Player B is 14 the output becomes 29 places into the text file.

So my logic is

Data stream of Player A is A
Data stream of Player B is B
ReadProcessData of A
ReadProcessData of B
combine? (I don't know C++ function to add) A and B to result in C
Fstream C to TeamA.txt **refresh every .2sec**

As long as the data streams are consider variables you can add them no? Any assistance is appreciate, if you'd like to help me please PM me. Thanks.


not quite sure what you mean with data-string, but assuming you have some arithmetic value stored in a text-string (something like "420" or "4.20") you can convert from a basic_string to arithmetic through functions like
stoi and stof etc...

string to int -> stoi
string to float -> stof

if you just add two strings with the binary + operator you will append the rhs string to the lhs string.

	string text="42.0";
float value=stof(text); //float value = 42.0f
auto new_text=text+text; //new_text is a string with value = "42.042.0"


their 'counterpart' is the to_string function that converts arithmetic into string, a la the integer 420 to the string "420".
here's a contrived example...

string t_0="32";
string t_1="10";
//convert t_0 and t_1 to ints, add them and pass the result to to_string
string t_2=to_string(stoi(t_0)+stoi(t_1)); //has value "42"
conspired against by a confederacy of dunces.
Pucca
Profile Blog Joined January 2012
Taiwan1280 Posts
January 15 2014 14:36 GMT
#8530
On January 15 2014 23:06 Tobberoth wrote:
Show nested quote +
On January 15 2014 22:35 Pucca wrote:
I'm working on a C++ program, I'm a noob so I was wondering if anyone could give some tips on my logic.

StarCraft 1 like any program has independent data strings for each piece of information in the game. My goal is to read this data string and place it into a constantly updating .txt file.

There are two data strings I have, Total Score of Player A and Total Score of Player B. I want to combine the two. So like Player A is 15 Player B is 14 the output becomes 29 places into the text file.

So my logic is

Data stream of Player A is A
Data stream of Player B is B
ReadProcessData of A
ReadProcessData of B
combine? (I don't know C++ function to add) A and B to result in C
Fstream C to TeamA.txt **refresh every .2sec**

As long as the data streams are consider variables you can add them no? Any assistance is appreciate, if you'd like to help me please PM me. Thanks.

Isn't this a very roundabout way of doing it? Isn't it better to parse the data from the processes into strings, then simply write these strings to the common file when they change?

Well, sure, If the refresh rate can be dependent upon when the value is change for sure, but each output file needs to be independent from each other in order to put into practical use.
Master Chief
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
Last Edited: 2014-01-15 18:14:49
January 15 2014 18:06 GMT
#8531
Why do I get a segmentation fault after writing even small numbers on the int prompt here?

+ Show Spoiler +

#include <stdio.h>
#include <stdlib.h>

int main()
{
int size;
int in;
int i = 0;
printf("Skriv hvor mange elementer du vil legge til: ");
scanf("%d", size);
int array[size];
while ( i < size )
{
printf("Skriv inn tallet du vil legge til: ");
scanf("%d", in);
array[i] = in;
i++;
}
i = 0;
while ( i < size )
{
printf("Tall: %d \n", array[i]);
i++;
}
}


Edit: Nevermind, forgot & before the ints, the most common mistake in the world...
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
Dknight
Profile Blog Joined April 2005
United States5223 Posts
Last Edited: 2014-01-16 19:06:15
January 16 2014 18:00 GMT
#8532
Problem solved!
WGT<3. Former CL/NW head admin.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 17 2014 01:33 GMT
#8533
On January 14 2014 11:39 sluggaslamoo wrote:
Show nested quote +
On January 14 2014 10:09 WarSame wrote:
On January 14 2014 07:52 sluggaslamoo wrote:
On January 13 2014 11:04 WarSame wrote:
Hey everyone, I finished my Pong game now! This time around I tried to obey Sluggaslamoo and Darkness and make it into a MVC project with clear and small methods. In general, I think I've done so correctly. The only thing that really stands out to me as a potential non-error downside is that when you press Space and are trying to move your paddle at the same time it sometimes stops your paddle. Also, I did a non-decorated Window because the borders were messing up the display. Paddles and the ball would go through the bottom border where they weren't visible, which caused problems.

The link is: https://github.com/WarSame/PongGraeme

EDIT: It contains an executable JAR if you feel like checking it out. Runs right out of the box. Don't need to download anything other than the JAR.


Its much better than your first so well done.

However its not really MVC as there are no models.

Make sure to create a class for each component in your project. Not because its MVC but because of OOP, object decomposition is fundamental to OOP. If you aren't decomposing your project into separate objects, then you may as well not be using Java .

You don't really need to think too hard about it either. What does a Ping Pong game consist of? Think about that, then make the appropriate classes and place the logic there.

Your code would be ok if it was written in a non-OO language though.

Thanks for the feedback. For MVC I thought that View = user display, Model = data, Control = controlling logic. As I saw it the Model was PongData, the View was PongPanel and the Control was PongFrame. I guess I really misunderstood what MVC is. Looking at Wikipedia this seems like it might be an example of a passive model, though, where the view is updated from the model by polling(by running the heartbeat cycle with sleep lengths). Maybe not, and honestly this is confusing me quite a bit by this point. Could you point out what you believe would make this into an MVC project?

As for making a class for each component of the project, I'm not really sure what you mean by that. Do you mean I should make one for Ball(with an X and Y value/speed), one for Paddle, and so on like that? If so, you are definitely right and I regret not doing that. If not could you please clarify it? And thanks for the feedback throughout, I definitely appreciate it. This project was a lot easier to handle organization-wise than the last one for Tic Tac Toe.


Yep basically what you said and not much more than that if at all. Those classes will basically serve as "models".

Controllers handle inputs. For example in a website it will handle the URL's, in your case its the game controller inputs. There should be minimal logic in the controller. Think about how much logic is in an actual game controller, it takes a signal, and converts it into an instruction to the game, that's all your controller should do as well. As a rule of thumb, light controllers, fat models.

Pretty much all the logic should be in your models. Anything code that has anything to do with a model, should be in the model itself. For example, "moving a Paddle", there should be a move method on the Paddle itself, don't write the logic in the controller or anywhere else. In the controller you would handle the mouse movement, and delegate all logic to the Paddle by passing in the mouse event or minimal information necessary.

You could also do it declaratively, by adding in a listener to the paddle in the beginning and firing it off with the controller.

When I was saying that your last example was MVC, I was more or less being tongue in cheek about MVC not being the issue there. When you do things properly your program will naturally become MVC of sorts. Even when you do implement what I said, it won't be MVC really.

MVC normally has an ORM associated with it, and you declare Models as an abstraction for saveable/stateful components in your application.

I only pointed it out because you specifically wanted your app to be MVC. I don't think its necessary to think of it like that though. MVC is much more useful for applications where you need to save state. This is more or less focused on doing Responsibility Driven Design.

Thank you to you and Blisse. I redid the design a bit and made it more MVC-like. I moved the data logic into PongData and created my Paddle and Ball classes. It turned out fairly nicely, I think, but there's still a few parts where it doesn't look as great as it probably could. Also, for some reason every once in a while the ball simple doesn't collide with the paddle and clips right through, but I can't track down why.

For now, it's likely done. At some point in the future I may come back and add in Ball[] and Paddle[] in order to allow for extras to be added in on demand.

The code is here: https://github.com/WarSame/PongGraeme
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
January 17 2014 02:00 GMT
#8534
On January 17 2014 10:33 WarSame wrote:
Show nested quote +
On January 14 2014 11:39 sluggaslamoo wrote:
On January 14 2014 10:09 WarSame wrote:
On January 14 2014 07:52 sluggaslamoo wrote:
On January 13 2014 11:04 WarSame wrote:
Hey everyone, I finished my Pong game now! This time around I tried to obey Sluggaslamoo and Darkness and make it into a MVC project with clear and small methods. In general, I think I've done so correctly. The only thing that really stands out to me as a potential non-error downside is that when you press Space and are trying to move your paddle at the same time it sometimes stops your paddle. Also, I did a non-decorated Window because the borders were messing up the display. Paddles and the ball would go through the bottom border where they weren't visible, which caused problems.

The link is: https://github.com/WarSame/PongGraeme

EDIT: It contains an executable JAR if you feel like checking it out. Runs right out of the box. Don't need to download anything other than the JAR.


Its much better than your first so well done.

However its not really MVC as there are no models.

Make sure to create a class for each component in your project. Not because its MVC but because of OOP, object decomposition is fundamental to OOP. If you aren't decomposing your project into separate objects, then you may as well not be using Java .

You don't really need to think too hard about it either. What does a Ping Pong game consist of? Think about that, then make the appropriate classes and place the logic there.

Your code would be ok if it was written in a non-OO language though.

Thanks for the feedback. For MVC I thought that View = user display, Model = data, Control = controlling logic. As I saw it the Model was PongData, the View was PongPanel and the Control was PongFrame. I guess I really misunderstood what MVC is. Looking at Wikipedia this seems like it might be an example of a passive model, though, where the view is updated from the model by polling(by running the heartbeat cycle with sleep lengths). Maybe not, and honestly this is confusing me quite a bit by this point. Could you point out what you believe would make this into an MVC project?

As for making a class for each component of the project, I'm not really sure what you mean by that. Do you mean I should make one for Ball(with an X and Y value/speed), one for Paddle, and so on like that? If so, you are definitely right and I regret not doing that. If not could you please clarify it? And thanks for the feedback throughout, I definitely appreciate it. This project was a lot easier to handle organization-wise than the last one for Tic Tac Toe.


Yep basically what you said and not much more than that if at all. Those classes will basically serve as "models".

Controllers handle inputs. For example in a website it will handle the URL's, in your case its the game controller inputs. There should be minimal logic in the controller. Think about how much logic is in an actual game controller, it takes a signal, and converts it into an instruction to the game, that's all your controller should do as well. As a rule of thumb, light controllers, fat models.

Pretty much all the logic should be in your models. Anything code that has anything to do with a model, should be in the model itself. For example, "moving a Paddle", there should be a move method on the Paddle itself, don't write the logic in the controller or anywhere else. In the controller you would handle the mouse movement, and delegate all logic to the Paddle by passing in the mouse event or minimal information necessary.

You could also do it declaratively, by adding in a listener to the paddle in the beginning and firing it off with the controller.

When I was saying that your last example was MVC, I was more or less being tongue in cheek about MVC not being the issue there. When you do things properly your program will naturally become MVC of sorts. Even when you do implement what I said, it won't be MVC really.

MVC normally has an ORM associated with it, and you declare Models as an abstraction for saveable/stateful components in your application.

I only pointed it out because you specifically wanted your app to be MVC. I don't think its necessary to think of it like that though. MVC is much more useful for applications where you need to save state. This is more or less focused on doing Responsibility Driven Design.

Thank you to you and Blisse. I redid the design a bit and made it more MVC-like. I moved the data logic into PongData and created my Paddle and Ball classes. It turned out fairly nicely, I think, but there's still a few parts where it doesn't look as great as it probably could. Also, for some reason every once in a while the ball simple doesn't collide with the paddle and clips right through, but I can't track down why.

For now, it's likely done. At some point in the future I may come back and add in Ball[] and Paddle[] in order to allow for extras to be added in on demand.

The code is here: https://github.com/WarSame/PongGraeme


Its possible that the ball may moving too many units per frame, so there is never a frame where they actually collide, the ball just jumps right past it. I haven't seen the code though.

If you think this is the case, have a look at interpolation. Basically at each frame you look at where the ball has been since the last frame and see if they should have collided.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2014-01-17 02:16:31
January 17 2014 02:16 GMT
#8535
Well the way I handled the collision was:

if the ball is not in the paddle, and the ball will be in the paddle on the next cycle, make the ball bounce. Depending on where it hit the paddle it then bounces differently.

Also, it seems kinda odd that you can use a Double to store the ball location and then paint it onto the screen as an int. I suppose the graphics library for Java has some sort of rounding function. Is that wrong?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
Last Edited: 2014-01-17 02:27:03
January 17 2014 02:25 GMT
#8536
On January 17 2014 11:16 WarSame wrote:
Well the way I handled the collision was:

if the ball is not in the paddle, and the ball will be in the paddle on the next cycle, make the ball bounce. Depending on where it hit the paddle it then bounces differently.

Also, it seems kinda odd that you can use a Double to store the ball location and then paint it onto the screen as an int. I suppose the graphics library for Java has some sort of rounding function. Is that wrong?


How do you check that the ball will be in the paddle on the next cycle though.

Ill give you an example


1 - 2 - 3 - 4 - 5 - 6
O []


The top row is distance units
O is the ball
[] is the paddle

If the ball moves 4 units per frame it will never hit the paddle, causing the collision to never happen.

With interpolation it would be like this

Woops the ball missed

1 - 2 - 3 - 4 - 5 - 6
---------[]---O


Do a line collision test between the two points and the ball can bounce.

@Other question: No clue, it probably get typecasted to an int.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2014-01-17 02:45:31
January 17 2014 02:27 GMT
#8537
For checking if it will be in the paddle on the next cycle I used the current position and the speed. I first check whether the current position was outside the paddle. Then I checked if the next position was inside the paddle. If it was I bounced the ball off of the paddle.

EDIT: So it's close to what you said. In my case it interpolated between the 2 points of the paddle location and the paddle thickness plus location.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
Last Edited: 2014-01-17 02:55:59
January 17 2014 02:54 GMT
#8538
On January 17 2014 11:27 WarSame wrote:
For checking if it will be in the paddle on the next cycle I used the current position and the speed. I first check whether the current position was outside the paddle. Then I checked if the next position was inside the paddle. If it was I bounced the ball off of the paddle.


This is the same as only checking once, but moving the ball after the check.

On January 17 2014 11:27 WarSame wrote:
For checking if it will be in the paddle on the next cycle I used the current position and the speed. I first check whether the current position was outside the paddle. Then I checked if the next position was inside the paddle. If it was I bounced the ball off of the paddle.

EDIT: So it's close to what you said. In my case it interpolated between the 2 points of the paddle location and the paddle thickness plus location.


Are you sure its interpolation and not just checking two points?
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
January 17 2014 02:58 GMT
#8539
Hey I'm going to enter uni as a CS student soon and I was wondering if the following would be considered a good portfolio to work at over the next four years.

For each language that I know, 9 small projects, 5 medium projects, and one big one. I currently know Java and Python, and I'm looking at learning C++, C#, C, PHP, and Ruby (on rails). In addition, I would add every solution that I have made from project euler, hopefully at least 100 of them.

Small projects would be just simple computations, perhaps rudimentary physics solvers, and other basic implementations of science stuff. Maybe some basic encryption. Medium projects would be more developed simulators, maybe some games, and generally projects with neater interfaces than just the command terminal. Also, simple web stuff. Decryption as well. Big projects would be things like apps, websites, maybe an actual physics environment, things like that.

First is this a decent selection of languages if I want to keep my options open for web or more general software? Is it feasible to finish this all in four years working sparingly at a pace of around 5 hr per week? Also, is it generally acceptable to include things you made for a class in a portfolio? Thanks in advance. I have a feeling that all these stupid code/STEM PR and awareness programs are going to push a lot of scrubs into CS so I want to be one of the better candidates for internships and jobs.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 17 2014 05:05 GMT
#8540
On January 17 2014 11:54 sluggaslamoo wrote:
Show nested quote +
On January 17 2014 11:27 WarSame wrote:
For checking if it will be in the paddle on the next cycle I used the current position and the speed. I first check whether the current position was outside the paddle. Then I checked if the next position was inside the paddle. If it was I bounced the ball off of the paddle.


This is the same as only checking once, but moving the ball after the check.

Show nested quote +
On January 17 2014 11:27 WarSame wrote:
For checking if it will be in the paddle on the next cycle I used the current position and the speed. I first check whether the current position was outside the paddle. Then I checked if the next position was inside the paddle. If it was I bounced the ball off of the paddle.

EDIT: So it's close to what you said. In my case it interpolated between the 2 points of the paddle location and the paddle thickness plus location.


Are you sure its interpolation and not just checking two points?

You're right. It's just checking points. I'm confused as to how you would do interpolation though? I've never seen that in any of my classes(which I'm increasingly believing are a waste of time and money).
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Prev 1 425 426 427 428 429 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 6m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 222
StarCraft: Brood War
Calm 7452
GuemChi 5113
Pusan 319
Zeus 138
ProTech134
910 99
Dewaltoss 50
soO 31
Shinee 22
Noble 15
[ Show more ]
Bale 13
ZergMaN 9
Icarus 9
Counter-Strike
Coldzera 1677
Stewie2K800
Super Smash Bros
Mew2King102
Other Games
summit1g6018
C9.Mang0482
m0e_tv307
RuFF_SC252
Livibee25
amsayoshi8
Organizations
Other Games
gamesdonequick855
BasetradeTV252
Dota 2
PGL Dota 2 - Main Stream147
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1583
• Stunt716
Upcoming Events
GSL
3h 6m
Rogue vs Percival
Zoun vs Solar
Replay Cast
17h 36m
GSL
1d 3h
Cure vs TriGGeR
ByuN vs Bunny
KCM Race Survival
1d 3h
Big Gabe
1d 5h
Replay Cast
1d 17h
Replay Cast
2 days
Escore
2 days
OSC
2 days
Replay Cast
2 days
[ Show More ]
Replay Cast
3 days
RSL Revival
3 days
IPSL
3 days
Ret vs Art_Of_Turtle
Radley vs TBD
BSL
3 days
Replay Cast
3 days
RSL Revival
4 days
uThermal 2v2 Circuit
4 days
BSL
4 days
IPSL
4 days
eOnzErG vs TBD
G5 vs Nesh
Replay Cast
5 days
Wardi Open
5 days
Afreeca Starleague
5 days
Jaedong vs Light
Monday Night Weeklies
5 days
Replay Cast
5 days
Sparkling Tuna Cup
6 days
Afreeca Starleague
6 days
Snow vs Flash
Liquipedia Results

Completed

Proleague 2026-04-28
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W5
KK 2v2 League Season 1
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
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 © 2026 TLnet. All Rights Reserved.