• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:47
CEST 03:47
KST 10:47
  • 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] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Official StarCraft website teases new content ahead of BlizzCon?67Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6
StarCraft 2
General
SC4ALL: II Winner Will Earn a Spot at HSC 30! Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game Weekly Cups (August 24-30): Patches' balance mod takes over Balance hotfix patch 5.0.16b (July 16) September World Ranking: herO leads, Serral climbs
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement PIG STY FESTIVAL 8.0! (13 - 23 August)
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? BW General Discussion ASL22 General Discussion [Personal Project Share] Terran Defense v0.60 BGH Auto Balance -> http://bghmmr.eu/
Tourneys
KCM Race Survival 2026 Season 3 Brood War in Budapest ! WORTEX 2026 BW Finals [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS
Strategy
Replay Review Process - What do you do? Game Theory for Starcraft Odyssey Mineral Stack Saturation Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Diablo IV EVE Corporation [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread Artificial Intelligence Thread UK Politics Mega-thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Dreaming of BW patches (mod…
c3rberUs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Customize Sidebar...

Website Feedback

Closed Threads



Active: 6028 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
Replay Cast
01:00
ISSL Weekly #3
EnkiAlexander 43
Liquipedia
Replay Cast
00:00
Enki Epic Series #10
Rogue vs Cure
CranKy Ducklings85
Liquipedia
The PiG Daily
22:35
GSTL Replay Cast
BASILISK vs Onsyde Gaming
PiGStarcraft478
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft478
ProTech154
RuFF_SC2 130
StarCraft: Brood War
Hyuk 51
Dota 2
NeuroSwarm120
League of Legends
Doublelift4187
Counter-Strike
taco 365
adren_tv124
minikerr34
Super Smash Bros
hungrybox537
Mew2King87
Other Games
summit1g4904
Day[9].tv771
JimRising 591
WinterStarcraft293
C9.Mang0261
Maynarde107
insan1a87
ViBE60
PPMD50
Organizations
Other Games
gamesdonequick1517
[ Show 12 non-featured ]
StarCraft 2
• CranKy Ducklings SOOP90
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• RayReign 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Day9tv771
• Scarra594
Upcoming Events
Big Brain Bouts
8h 13m
Garitos vs ArT
Lambo vs Percival
TriGGeR vs ByuN
Sparkling Tuna Cup
1d 8h
OSC
1d 10h
Shopify Rebellion Sundays
1d 13h
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Patches Events
1d 14h
OSC
1d 22h
Afreeca Starleague
2 days
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
2 days
Afreeca Starleague
3 days
Leta vs ggaemo
Jaedong vs Queen
GSL
3 days
[ Show More ]
PiGosaur Cup
3 days
Kung Fu Cup
4 days
Replay Cast
4 days
The PondCast
5 days
KCM Race Survival
5 days
Escore
6 days
IntoTheTV X SOOP
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
Acropolis #5 - TRS
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
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
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.