• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 06:17
CET 12:17
KST 20:17
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband Information Request Regarding Chinese Ladder
Tourneys
$5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Data analysis on 70 million replays Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Nintendo Switch Thread Should offensive tower rushing be viable in RTS games?
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1187 users

The Big Programming Thread - Page 427

Forum Index > General Forum
Post a Reply
Prev 1 425 426 427 428 429 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Shikada
Profile Joined May 2012
Serbia976 Posts
January 15 2014 00:07 GMT
#8521
Just to make what sluggaslamoo said more clear, while he says that polling similar to this is used in most frameworks, don't think that a serious, or let alone industry strength framework, would ever literally use a construct like this. The while loop would never have an empty body, at least the thread would be put to sleep, to not waste CPU resources.
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
January 15 2014 00:29 GMT
#8522
On January 15 2014 08:43 Zocat wrote:
It's called busy spin / spin lock afaik.
Overall you should avoid using it, since it just burns the CPU.

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


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

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


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


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

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


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


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


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

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

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

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

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

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

So my logic is

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

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


T t;
K k;

System.out.println(t + k);


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

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

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

So my logic is

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

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

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


T t;
K k;

System.out.println(t + k);


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


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

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

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

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

So my logic is

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

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


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

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

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

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


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

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

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

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

So my logic is

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

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

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

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

+ Show Spoiler +

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

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


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

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

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


Its much better than your first so well done.

However its not really MVC as there are no models.

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


Its much better than your first so well done.

However its not really MVC as there are no models.

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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


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

Ill give you an example


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


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

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

With interpolation it would be like this

Woops the ball missed

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


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

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

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


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

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

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


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

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

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

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


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

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

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


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

You're right. It's just checking points. I'm confused as to how you would do interpolation though? I've never seen that in any of my classes(which I'm increasingly believing are a waste of time and money).
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Prev 1 425 426 427 428 429 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 44m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 212
ProTech116
MindelVK 43
StarCraft: Brood War
Calm 5111
Shuttle 1675
Horang2 1662
actioN 642
Jaedong 598
Hyun 261
Mini 259
Light 195
Last 156
Rush 131
[ Show more ]
EffOrt 126
ZerO 115
Pusan 94
Snow 91
Sharp 71
Zeus 71
ToSsGirL 54
Killer 46
hero 45
sorry 41
Mong 36
NotJumperer 27
soO 21
scan(afreeca) 16
ajuk12(nOOB) 14
Hm[arnc] 7
Dota 2
XaKoH 441
League of Legends
JimRising 330
Reynor14
Counter-Strike
olofmeister1809
shoxiejesuss734
x6flipin173
allub138
Other Games
B2W.Neo338
Fuzer 187
KnowMe78
ZerO(Twitch)7
Organizations
Other Games
gamesdonequick627
StarCraft: Brood War
lovetv 6
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH151
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota273
League of Legends
• Jankos2206
• Stunt829
Upcoming Events
Wardi Open
44m
StarCraft2.fi
5h 44m
Replay Cast
12h 44m
The PondCast
22h 44m
OSC
1d 4h
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 12h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
3 days
SC Evo League
3 days
[ Show More ]
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
WardiTV 2025
4 days
OSC
4 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
5 days
StarCraft2.fi
5 days
Replay Cast
5 days
WardiTV 2025
6 days
StarCraft2.fi
6 days
PiGosaur Monday
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

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

Advertising | Privacy Policy | Terms Of Use | Contact Us

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