• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:37
CEST 15:37
KST 22:37
  • 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
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Balance hotfix patch 5.0.16b (July 16)46Reynor: GSL Loss Wasn't About Preparation Format16[IPSL] Spring 2026 Grand Finals - This Weekend!5Weekly Cups (July 6 - 12): Protoss strike back12BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Balance hotfix patch 5.0.16b (July 16) [D] Wireframe Casting Removed Clem: "I don't have that much hope in Blizzard" Reynor: GSL Loss Wasn't About Preparation Format Is the larve respawn broken?
Tourneys
Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026 GSL CK #5 Race War RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
ASL22 General Discussion BW General Discussion Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) Etiquete rules in Asl? Recent recommended BW games
Tourneys
[Megathread] Daily Proleagues Escore Tournament - Season 3 Small VOD Thread 2.0 [IPSL] Spring 2026 Grand Finals - This Weekend!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Path of Exile General RTS Discussion Thread Nintendo Switch Thread Beyond All Reason Stormgate/Frost Giant Megathread
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread UK Politics Mega-thread YouTube Thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Req][Books] Good Fantasy/SciFi books Series you have seen recently...
Sports
2024 - 2026 Football Thread MLB/Baseball 2023 McBoner: A hockey love story Tennis[sport] Formula 1 Discussion
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
Poker (part 2)
Nebuchad
The Experiences We Want and …
TrAiDoS
An Exploration of th…
waywardstrategy
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8828 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 States5224 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
Epic.LAN
13:00
Epic.LAN 48 Playoff Stage
epiclan23
Liquipedia
WardiTV Invitational
12:00
Summer Cup 2026 - Group A
WardiTV785
LiquipediaDiscussion
CranKy Ducklings
10:00
Master Swan Open #105
CranKy Ducklings58
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko528
Rex 109
BRAT_OK 101
MindelVK 27
RushiSC 22
StarCraft: Brood War
Calm 8092
Rain 2270
Shuttle 1994
Jaedong 1206
Hyuk 962
firebathero 743
Mini 638
BeSt 524
Horang2 513
Larva 211
[ Show more ]
Stork 211
Rush 204
ZerO 160
hero 133
Hyun 119
Last 118
Sharp 105
Pusan 99
ggaemo 95
JulyZerg 64
JYJ 56
Killer 49
Mong 49
Free 43
sorry 37
soO 36
Movie 29
Shine 27
Aegong 25
HiyA 23
ToSsGirL 17
Hm[arnc] 17
NaDa 14
yabsab 13
Barracks 12
IntoTheRainbow 9
Noble 9
ajuk12(nOOB) 8
Rock 7
Purpose 6
Icarus 5
Dota 2
Gorgc5704
XcaliburYe198
League of Legends
Doublelift3611
Counter-Strike
byalli1695
allub430
Heroes of the Storm
Khaldor136
Trikslyr14
Other Games
gofns20204
singsing1912
B2W.Neo814
RotterdaM196
Hui .136
XaKoH 127
DeMusliM126
ZerO(Twitch)13
BlysK5
Organizations
Other Games
gamesdonequick2306
BasetradeTV169
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• CranKy Ducklings SOOP79
• musti20045 18
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Pr0nogo 4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 540
League of Legends
• Jankos3329
Upcoming Events
IPSL
2h 23m
Dragon vs Hawk
RSL Revival
19h 23m
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
20h 23m
OSC
23h 23m
IPSL
1d 2h
Bonyth vs Ret
WardiTV Weekly
1d 21h
Monday Night Weeklies
2 days
PiGosaur Cup
3 days
The PondCast
3 days
Replay Cast
4 days
[ Show More ]
CrankTV Team League
4 days
Replay Cast
5 days
CrankTV Team League
5 days
Korean StarCraft League
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Escore Tournament S3: W3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
YSL S3
CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
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.