• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 01:10
CET 06:10
KST 14:10
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (October 19-25): Clem triples first in 5.0.174Evil Geniuses - shutting down20ISSL (IntoTheTV x SOOP SC2 League): Premier5Weekly Cups (October 12-18): 5.0.17 era begins1[$1250] International ShieldBattery League92
StarCraft 2
General
No more SC2 streamers on team liquid? How do you feel about the mass reverts in the 5.0.17 PTR? Weekly Cups (October 19-25): Clem triples first in 5.0.17 Evil Geniuses - shutting down REPORT: StarCraft 2: Remastered In Development
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) RSL 2026 Offline Finals LCQ Sign-Ups Sparkling Tuna Cup - Weekly Open Tournament 2026 KungFu Cup Announcement RSL goes to London! 2026 Offline Finals Nov 21-22
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Simple Questions/Answers [G] How to playtest arcade maps [A] Nemrods 1/4 players
External Content
Mutation # 549 Endless Sparkles The PondCast: SC2 News & Results Mutation # 548 Shining Bright Mutation # 547 Temple Of Terror
Brood War
General
SC4ALL II Brood War Complete Invited Player Lineup [Megathread] Daily Funny Videos BW General Discussion Rollback Netcode in Brood War Sagi.gg Launcher Released
Tourneys
Small VOD Thread 2.0 [Women's StarCraft] MonstarZ vs BA 2026-10-30 [IPSL] IPSL Winter 26-27 Ro24 is HERE! [Megathread] Daily Proleagues
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mobile Legends: Bang Bang Armies of Exigo - YesYes? General RTS Discussion Thread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine R I P Patrick Stewart European Politico-economics QA Mega-thread
Fan Clubs
Reynor Fan Club The Flash Fan Club Serral Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8912 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 States5225 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 6h 51m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ViBE154
SortOf 98
StarCraft: Brood War
GuemChi 1729
Hyuk 1263
ProTech164
Dewaltoss 141
Icarus 8
Force[name] 6
Dota 2
NeuroSwarm180
League of Legends
Doublelift4443
JimRising 656
Other Games
summit1g10004
Coldzera 676
WinterStarcraft482
C9.Mang0201
Sick51
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota244
League of Legends
• Stunt385
Other Games
• Shiphtur498
Upcoming Events
GSL
6h 51m
Epic.LAN
7h 51m
Big Brain Bouts
11h 51m
OSC
16h 51m
Replay Cast
17h 51m
Sparkling Tuna Cup
1d 4h
WardiTV Invitational
1d 6h
Epic.LAN
1d 7h
IPSL
1d 10h
eOnzErG vs McRibbed
LancerX vs StRyKeR
AI Arena Tournament
1d 12h
[ Show More ]
OSC
2 days
Yamato Cup
2 days
IPSL
2 days
Artosis vs RiceHat
Kyrie vs Sony
Map Test Tournament
2 days
WardiTV Weekly
3 days
Ultimate Battle
3 days
Rush vs BeSt
Replay Cast
3 days
Rogue vs Classic
Patches Events
4 days
PiGosaur Cup
4 days
Kung Fu Cup
5 days
The PondCast
6 days
KCM Race Survival
6 days
Liquipedia Results

Completed

Proleague 2026-10-28
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026

Upcoming

IPSL Winter 2026-27
1xBet Invitational
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 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.