• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:36
CEST 15:36
KST 22:36
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles1[BSL20] Non-Korean Championship 4x BSL + 4x China7Flash Announces Hiatus From ASL64Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
SC uni coach streams logging into betting site BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [BSL20] Non-Korean Championship 4x BSL + 4x China CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024! Summer Games Done Quick 2025!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 723 users

The Big Programming Thread - Page 189

Forum Index > General Forum
Post a Reply
Prev 1 187 188 189 190 191 1031 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.
GoonSack
Profile Joined January 2011
New Zealand36 Posts
November 07 2012 07:59 GMT
#3761
On November 06 2012 20:41 sluggaslamoo wrote:
Show nested quote +
On November 06 2012 18:41 Tobberoth wrote:
The dominance of linux in server environments is greatly overstated. A lot of huge companies use microsoft products for everything. All their internal programs are made in C#, all their computers run windows 7, all their intranet sites run on ASP.NET, all their SQL is in SQL Server databases... companies like this phase out Linux, which they got years ago when it was a fad for big companies to move over to Linux. Dealing with integration is a bigger problem than the money saved by using Linux, especially since the license fees make such a small difference for big companies.

I think it's cool for college students to work in Linux because they prefer it or whatever, but it's probably a good idea to think about what kind of company you will be working for and what the trends are. Ruby on rails is awesome to know if you're going to work for a small hipp company selling websites, not so much if you're going to be working for the IT department of a huge company.


Integration is a bigger issue on windows servers. Linux you just use package managers and its so easy to clone with things like vagrant and chef. I have so many integration issues with windows server its not funny.


Youre right however I think the point he was making is that large companies that are stuck using windows software already prefer to avoid integration costs altogether by also running windows servers.
goons of korhal
Craton
Profile Blog Joined December 2009
United States17247 Posts
November 09 2012 01:31 GMT
#3762
Census uses almost entirely Unix and Oracle, FWIW.
twitch.tv/cratonz
bokeevboke
Profile Blog Joined May 2010
Singapore1674 Posts
Last Edited: 2012-11-09 10:48:04
November 09 2012 10:46 GMT
#3763
I was playing with the idea of making an open-source rts project (starcraft clone, all intellectual property shenanigans taken into consideration). Right now we are too dependant on Blizzard, imagine if we had our own game.

I'm java programmer, and as you may know java has one of the biggest open-source communities. So I was thinking why not make an rts? Is there anyone anyone with gamedev background? Please give your insights.
Its grack
Fyodor
Profile Blog Joined September 2010
Canada971 Posts
November 09 2012 10:58 GMT
#3764
On November 09 2012 19:46 bokeevboke wrote:
I was playing with the idea of making an open-source rts project (starcraft clone, all intellectual property shenanigans taken into consideration). Right now we are too dependant on Blizzard, imagine if we had our own game.

I'm java programmer, and as you may know java has one of the biggest open-source communities. So I was thinking why not make an rts? Is there anyone anyone with gamedev background? Please give your insights.

RTS is a complicated genre to develop. Depends a lot on pathfinding and AI so a simple programmer would have a pretty tough time of it.

If you have it exclusively multiplayer then I guess you can reduce the complexity by removing the need for AI. Unreal Engine and Unity give you some facilities for network code and pathfinding I think so it could be possible to see an indie RTS.

I recommend brushing up on C# or UnrealScript if you want to use a modern engine, however. Java is really barren in terms of gamedev tools.
llllllllllllllllllllllllllllllllllllllllllll
chaokel
Profile Blog Joined October 2010
Australia535 Posts
November 09 2012 11:01 GMT
#3765
Sounds like a huge amount of work. I'm just going to put it out there, that there is no way you can create such a project on your own.

If you want to make games, start with something small then as you build experience and contacts you can try creating a major project.

With no prior experience, starting on a project of that size is almost guaranteed to be doomed to fail.

-source: Have completed several small games from scratch in groups as well as solo, and am currently studying games programming.
bokeevboke
Profile Blog Joined May 2010
Singapore1674 Posts
Last Edited: 2012-11-09 11:46:11
November 09 2012 11:45 GMT
#3766
On November 09 2012 19:58 Fyodor wrote:
Show nested quote +
On November 09 2012 19:46 bokeevboke wrote:
I was playing with the idea of making an open-source rts project (starcraft clone, all intellectual property shenanigans taken into consideration). Right now we are too dependant on Blizzard, imagine if we had our own game.

I'm java programmer, and as you may know java has one of the biggest open-source communities. So I was thinking why not make an rts? Is there anyone anyone with gamedev background? Please give your insights.

RTS is a complicated genre to develop. Depends a lot on pathfinding and AI so a simple programmer would have a pretty tough time of it.

If you have it exclusively multiplayer then I guess you can reduce the complexity by removing the need for AI. Unreal Engine and Unity give you some facilities for network code and pathfinding I think so it could be possible to see an indie RTS.

I recommend brushing up on C# or UnrealScript if you want to use a modern engine, however. Java is really barren in terms of gamedev tools.


I already started doing RPG project on Unity. Stuff like game logic, path-finding, collision detection are already there. My basic game was ready in ~4 days. What I most struggle with is creating game world, map, terrain, 3d models and animation. Which, i think, is where game-community shines the most.

though I haven't touched networking part yet. But making a game for a simple LAN might be a good start.
Its grack
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2012-11-09 15:48:24
November 09 2012 15:47 GMT
#3767
in c# 2010 express i have:

+ Show Spoiler +

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 a1 = new Form2();
a1.ShowDialog();
}
}
}


the first time i run this i got

'WindowsFormsApplication1.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing using directive or an assembly reference?)


my tutor said to close the project and rewrite what i had in a new c# project.
i made it identicle and ran it. this time it worked fine.

does anyone know why this bugged?

thanks...just curious (total beginner)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Rixxe
Profile Joined July 2011
United Kingdom136 Posts
Last Edited: 2012-11-09 15:57:19
November 09 2012 15:55 GMT
#3768
On November 10 2012 00:47 FFGenerations wrote:
in c# 2010 express i have:

+ Show Spoiler +

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 a1 = new Form2();
a1.ShowDialog();
}
}
}


the first time i run this i got

'WindowsFormsApplication1.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing using directive or an assembly reference?)


my tutor said to close the project and rewrite what i had in a new c# project.
i made it identicle and ran it. this time it worked fine.

does anyone know why this bugged?

thanks...just curious (total beginner)



In your designer, you were probably missing something like this:

 
this.Load += new System.EventHandler(this.Form1_Load);


Edit: You had the code above, with no method. Sorry i got it the wrong way around.... been a while since i used C#.
SAS is too much fun.... jk
*bleep* you up in a gangsta style!
Alryk
Profile Blog Joined November 2011
United States2718 Posts
Last Edited: 2012-11-09 19:36:55
November 09 2012 19:17 GMT
#3769
+ Show Spoiler +
Hey guys... not sure if this falls in the range of the type of programming y'all are talking about, but: I'm using labview for an engineering project. We have these little robot cars that we're trying to steer through a maze. Currently, I have a labview program that uses a touch sensor loop so that every single time the bumper "touches" something, the robot backs up and turns to the right. To navigate the maze, I'd like to make it so that the first time it hits a touch sensor, the robot moves left, but the second time, it moves right. Does this make sense at all, and if so can anybody at least point me in the right direction of how to do this?

I don't know why the picture would help at all but here's a picture of the program. If I need to explain more clearly please let me know how I could do that.+ Show Spoiler +
[image loading]


Picture too wide: here

Basically, I'm trying to make it a conditional event that doesn't work until the bumper touches something once, and then I want it to execute a DIFFERENT program the second time the bumper touches. I know it's possible, but where would I start to figure out how to do it?


Spoiler for old but I think bad post.

I want to use a timed loop in Labview to set up two different iterations. I converted a loop into a timed loop, but I'm not sure how to connect iterations or set up their lengths. How do I do this?
Team Liquid, IM, ViOlet!
Craton
Profile Blog Joined December 2009
United States17247 Posts
Last Edited: 2012-11-10 00:13:11
November 10 2012 00:12 GMT
#3770
On November 10 2012 00:47 FFGenerations wrote:
in c# 2010 express i have:

+ Show Spoiler +

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 a1 = new Form2();
a1.ShowDialog();
}
}
}


the first time i run this i got

'WindowsFormsApplication1.Form1' does not contain a definition for 'Form1_Load' and no extension method 'Form1_Load' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing using directive or an assembly reference?)


my tutor said to close the project and rewrite what i had in a new c# project.
i made it identicle and ran it. this time it worked fine.

does anyone know why this bugged?

thanks...just curious (total beginner)

Basically Windows Forms has automatically generated code that gets made when you do various things. In this case, probably when you doubleclicked on the form. Later, you probably deleted that empty method, but the method was still listed in your events tab and so the auto-generated lines still existed (which were now pointing to something that didn't exist). Fix it here (see below) and the error will go away.

[image loading]

Alternatively, you might have renamed (instead of refactored) something.
twitch.tv/cratonz
white_horse
Profile Joined July 2010
1019 Posts
Last Edited: 2012-11-13 01:11:05
November 10 2012 03:21 GMT
#3771
Translator
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2012-11-10 03:51:21
November 10 2012 03:48 GMT
#3772
I'm not sure if I'm just reading your code wrong, but you have your rows and columns mixed up so it's making it weird to debug.

Row is the X component, Column is the Y component, at least in standard English.


You should break this problem up, again, into many functions so your main is a lot easier to debug by breaking down the problem into very abstract levels. If you've learned classes, a struct car with current position x and y would be useful to have for this. You can do it without a struct too. PrintTrack() is good. CalculateXandYPosition() would be good too, with an UpdateCarPosition(). Then you program the bare basics, and add in new and more complex functionality, testing every time until you have the finished product.

If you program this way, if and when you encounter a bug, you can go through each method and say, this is working 100%, the error is not here. In this situation, I would have created a race program that moved the car one step at a time until you know all those parts are working 100%, then add in the custom acceleration bits in the CalculateXandYPosition(). This way, you can narrow down if it was the custom acceleration that broke the code, or if your general logic is flawed. If you got this same error, you would have found in the earlier stages that your car didn't move in the correct direction.
There is no one like you in the universe.
white_horse
Profile Joined July 2010
1019 Posts
November 10 2012 03:54 GMT
#3773
Oops sorry, I should have mentioned this: I switched the row and columns because the horizontal movement of the "car" corresponds to columns and the vertical movement of the "car" corresponds to rows.

thanks for the advice!!
Translator
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2012-11-10 06:52:40
November 10 2012 04:20 GMT
#3774
I believe your issue is that you use equalities like x == 0, rather than x <= 0, since you never have any hardcoded bounds to your x and y components.

Also, I believe you should be getting array out of bounds errors a bunch. You should do the


track[yPosition][xPosition] = '0';


in the conditional loop and


printRace(track);


after making sure your X and Y indices are not out of bounds.
There is no one like you in the universe.
tec27
Profile Blog Joined June 2004
United States3696 Posts
November 10 2012 04:47 GMT
#3775
On November 10 2012 12:21 white_horse wrote:
Ok so I have to make a simple racing game where the user inputs 1, 0, or -1 for the increments in horizontal and vertical acceleration/deceleration to guide the "car" (which is represented as a "0" in the text game) to the finish line.

The part that I'm having trouble with is when the "car" crashes into the side of the wall or barrier. The code is supposed to be so that the "car" is embedded in the side of the wall or barrier but I'm not sure how to make it work. Will someone help me?

The project information is here:
+ Show Spoiler +
http://www.umich.edu/~engr101/Bielajew/a6.pdf



and what I have so far is here:

the code that is specifically giving me trouble is near the bottom, which I marked. Everything above that is working fine I believe.

+ Show Spoiler +


#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;


const int row = 52;
const int column = 72;


void printRace(char array1[row][column] //prints 52 by 72 grid
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
cout << array1[i][j];
}
cout << endl;
}
}


void initRace(char array2[row][column] //prints track layout
{

for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
if (i == 0) //top boundary
{
array2[i][j] = 'X';
}
else if (i == 51 && j < 65) //bottom boundary
{
array2[i][j] = 'X';
}
else if (i == 51 && j < 71) //prints finish line
{
array2[i][j] = 'F';
}
else if ((i >= 1 && i <= 51) && j == 0) //left boundary
{
array2[i][j] = 'X';
}
else if ((i >= 1 && i <= 51) && j == 71) //right boundary
{
array2[i][j] = 'X';
}
else if ((i >= 1 && i <= 35) && (j >= 10 && j <= 29)) //left barrier
{
array2[i][j] = 'X';
}
else if ((i >= 16 && i <= 50) && (j >= 40 && j <= 64)) //right barrier
{
array2[i][j] = 'X';
}
else
{
array2[i][j] = ' ';
}
}
}
}




int main()
{
char track[row][column];
initRace(track);
track[1][1] = '0';
printRace(track);

int xVelocity = 0, xAcceleration = 0;
int yVelocity = 0, yAcceleration = 0;
int xPosition = 1, yPosition = 1;
int counter = 0; //counter for seconds


while(1)
{
cout << "Horizontal and vertical acceleration (-1, 0, 1): ";
cin >> xAcceleration >> yAcceleration;
counter++;

if (xAcceleration < -1 || xAcceleration > 1)
{
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
return -1;
}
if (yAcceleration < -1 || yAcceleration > 1)
{
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
return -1;
}


xVelocity = xVelocity + xAcceleration;
yVelocity = yVelocity + yAcceleration;

xPosition = xPosition + xVelocity;
yPosition = yPosition + yVelocity;


track[yPosition][xPosition] = '0';
printRace(track);



>>>>>>>>>>>>>>>>>>>> CODE BELOW HERE IS NOT WORKING <<<<<<<<<<<<<<<<<<<<<<<<


if ((yPosition == 0 && xPosition < 10) || (yPosition == 0 && xPosition > 30)) //when car is embedded in top boundary
{
track[0][xPosition] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if (yPosition == 51 && xPosition < 41) //when car is embedded in bottom boundary
{
track[51][xPosition] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if ((yPosition >= 1 && yPosition <= 51) && xPosition == 0) //when car is embedded in left boundary
{
track[yPosition][0] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if ((yPosition >= 1 && yPosition <= 51) && xPosition == 71) //when car is embedded in right boundary
{
track[yPosition][71] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}


return 0;

}




I hope you get this figured out, but I think you're really disadvantaging yourself. You've posted code for help like this pretty much every week without fail. From the thread rules:
2. Don't post a huge block of code and ask "what's wrong?" or I'll smack you.

There's a few reasons for this rule, I think. Number one is that it makes the thread pretty noisy and irrelevant to the vast majority of readers. Number two is that it doesn't promote interesting discussion. Number three is that it prevents you from learning how to figure out your own mistakes. This is especially evident from how many times you've come back here to ask the same sorts of things. I know, the learning curve is tough, but you have to push through that if you want to *actually* figure this stuff out.

I (and I'm sure a lot of other people) would appreciate it if you didn't post your homework in here every week. Homework threads are also banned on TL, I don't see why homework posts would be allowed considering that
Can you jam with the console cowboys in cyberspace?
SgtCoDFish
Profile Blog Joined July 2010
United Kingdom1520 Posts
November 10 2012 04:51 GMT
#3776
While I'm too drunk atm to actually debug (although the guy above has a good point from what I can see):

I'd recommend you use a function to change the array rather than doing it manually all over the place. You can bake the array bounds checking into the function and it means you can only possibly fuck up the notation in one place rather than everywhere.

Either use a global track[][] array and have the bounds global too and just use a function like

void setScreenAt(int xCoord, int yCoord);

or pass a pointer and the bounds every time (might want to make a

struct trackData{ int **track; int rowSize; int colSize; };

to simplify that).

Now I've typed that I like the idea of having just

bool updateCar(int newXPos, int newYPos);

and you can add bounds checking and also check if the car is still in play, and return true if out of play and the game is over or false if we can continue to the next frame.

Also, you have the track dimensions set as variables at the beginning (which is good) and then don't use those variables to check if the car has gone out of play and use hard-coded numbers instead. This is another way to introduce silly, hard to fix bugs and also makes the game a bitch to customise later (not saying you'll want to do that, but it's good to bear in mind)

Finally, and I don't suggest you change this now, I'd personally use a single-dimenional array and access elements using

track[(rowWidth * y) + x ]

which I find personally easier to deal with, but that's pretty much personal preference. There may be slight speed differences, but they won't matter a damn in an ascii car game

If anyone would like to debunk my drunken logic, please do. I don't claim to be an expert.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
November 10 2012 04:52 GMT
#3777
On November 10 2012 13:47 tec27 wrote:
Show nested quote +
On November 10 2012 12:21 white_horse wrote:
Ok so I have to make a simple racing game where the user inputs 1, 0, or -1 for the increments in horizontal and vertical acceleration/deceleration to guide the "car" (which is represented as a "0" in the text game) to the finish line.

The part that I'm having trouble with is when the "car" crashes into the side of the wall or barrier. The code is supposed to be so that the "car" is embedded in the side of the wall or barrier but I'm not sure how to make it work. Will someone help me?

The project information is here:
+ Show Spoiler +
http://www.umich.edu/~engr101/Bielajew/a6.pdf



and what I have so far is here:

the code that is specifically giving me trouble is near the bottom, which I marked. Everything above that is working fine I believe.

+ Show Spoiler +


#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;


const int row = 52;
const int column = 72;


void printRace(char array1[row][column] //prints 52 by 72 grid
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
cout << array1[i][j];
}
cout << endl;
}
}


void initRace(char array2[row][column] //prints track layout
{

for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
if (i == 0) //top boundary
{
array2[i][j] = 'X';
}
else if (i == 51 && j < 65) //bottom boundary
{
array2[i][j] = 'X';
}
else if (i == 51 && j < 71) //prints finish line
{
array2[i][j] = 'F';
}
else if ((i >= 1 && i <= 51) && j == 0) //left boundary
{
array2[i][j] = 'X';
}
else if ((i >= 1 && i <= 51) && j == 71) //right boundary
{
array2[i][j] = 'X';
}
else if ((i >= 1 && i <= 35) && (j >= 10 && j <= 29)) //left barrier
{
array2[i][j] = 'X';
}
else if ((i >= 16 && i <= 50) && (j >= 40 && j <= 64)) //right barrier
{
array2[i][j] = 'X';
}
else
{
array2[i][j] = ' ';
}
}
}
}




int main()
{
char track[row][column];
initRace(track);
track[1][1] = '0';
printRace(track);

int xVelocity = 0, xAcceleration = 0;
int yVelocity = 0, yAcceleration = 0;
int xPosition = 1, yPosition = 1;
int counter = 0; //counter for seconds


while(1)
{
cout << "Horizontal and vertical acceleration (-1, 0, 1): ";
cin >> xAcceleration >> yAcceleration;
counter++;

if (xAcceleration < -1 || xAcceleration > 1)
{
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
return -1;
}
if (yAcceleration < -1 || yAcceleration > 1)
{
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
return -1;
}


xVelocity = xVelocity + xAcceleration;
yVelocity = yVelocity + yAcceleration;

xPosition = xPosition + xVelocity;
yPosition = yPosition + yVelocity;


track[yPosition][xPosition] = '0';
printRace(track);



>>>>>>>>>>>>>>>>>>>> CODE BELOW HERE IS NOT WORKING <<<<<<<<<<<<<<<<<<<<<<<<


if ((yPosition == 0 && xPosition < 10) || (yPosition == 0 && xPosition > 30)) //when car is embedded in top boundary
{
track[0][xPosition] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if (yPosition == 51 && xPosition < 41) //when car is embedded in bottom boundary
{
track[51][xPosition] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if ((yPosition >= 1 && yPosition <= 51) && xPosition == 0) //when car is embedded in left boundary
{
track[yPosition][0] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}

if ((yPosition >= 1 && yPosition <= 51) && xPosition == 71) //when car is embedded in right boundary
{
track[yPosition][71] = '0';
printRace(track);
cout << "Crashed after " << counter << " seconds" << endl;
}


return 0;

}




I hope you get this figured out, but I think you're really disadvantaging yourself. You've posted code for help like this pretty much every week without fail. From the thread rules:
Show nested quote +
2. Don't post a huge block of code and ask "what's wrong?" or I'll smack you.

There's a few reasons for this rule, I think. Number one is that it makes the thread pretty noisy and irrelevant to the vast majority of readers. Number two is that it doesn't promote interesting discussion. Number three is that it prevents you from learning how to figure out your own mistakes. This is especially evident from how many times you've come back here to ask the same sorts of things. I know, the learning curve is tough, but you have to push through that if you want to *actually* figure this stuff out.

I (and I'm sure a lot of other people) would appreciate it if you didn't post your homework in here every week. Homework threads are also banned on TL, I don't see why homework posts would be allowed considering that

Yeah, plus he ignored a long post I made explaining things to him a while ago
Recognizable
Profile Blog Joined December 2011
Netherlands1552 Posts
Last Edited: 2012-11-10 12:43:39
November 10 2012 12:34 GMT
#3778
My first code

from datetime import datetime
now=datetime.now()
print (now)
current_year=now.year
current_month=now.month
current_day=now.day
hour=now.hour
minute=now.minute
second=now.second
slash="/"
print (str(current_day) + (slash) + str(current_month) + (slash) + str(current_year) +" "+ str(hour) + ":" + str(minute) + ":" +str(second))

This is what you'll get: 10/11/2012 13:30:48
I'm going through the python codeacademy classes right now.

Does anyone have a useful site for an overview of the very basics of programming? IE: One that explains what a variable is and lists the types of variables. Codeacademy does this aswell but it doesn't give you a nice overview.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
November 10 2012 13:10 GMT
#3779
thanks for replies, i have a better idea of what might have happened now. might have been something like, i doubleclicked the form randomly then deleted the auto code
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
myzael
Profile Blog Joined November 2008
Poland605 Posts
November 10 2012 13:45 GMT
#3780
On November 10 2012 21:34 Recognizable wrote:
My first code

from datetime import datetime
now=datetime.now()
print (now)
current_year=now.year
current_month=now.month
current_day=now.day
hour=now.hour
minute=now.minute
second=now.second
slash="/"
print (str(current_day) + (slash) + str(current_month) + (slash) + str(current_year) +" "+ str(hour) + ":" + str(minute) + ":" +str(second))

This is what you'll get: 10/11/2012 13:30:48
I'm going through the python codeacademy classes right now.

Does anyone have a useful site for an overview of the very basics of programming? IE: One that explains what a variable is and lists the types of variables. Codeacademy does this aswell but it doesn't give you a nice overview.


You might want to get used to the following formatting, it is both clearer and more widespread:
print "%s/%s/%s %s:%s:%s" % (str(current_day), str(current_month), str(current_year), str(hour), str(minute), str(second))


Also, you don't need that many brackets.

Furthermore, not trying to be rude or smartass, but python is about clarity IMO.
from datetime import datetime
print datetime.now().strftime("%d/%m/%Y %H:%M:%S")


As for introduction. You are trying to write in python. Why not start with this: http://docs.python.org/2.7/tutorial/introduction.html ?
Prev 1 187 188 189 190 191 1031 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
11:00
#43
WardiTV1322
OGKoka 522
Harstem427
IndyStarCraft 169
Rex167
CranKy Ducklings122
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 522
Harstem 427
Hui .184
IndyStarCraft 169
Rex 167
StarCraft: Brood War
Bisu 2963
Flash 2112
Jaedong 1818
Hyuk 1166
firebathero 688
EffOrt 645
ZerO 538
Larva 508
actioN 436
Soulkey 387
[ Show more ]
Stork 378
Snow 308
Soma 275
GuemChi 168
Mind 132
sSak 113
Pusan 111
Light 98
PianO 80
hero 77
Sharp 74
JulyZerg 72
TY 55
Barracks 46
Sea.KH 44
Yoon 38
Aegong 35
sorry 32
Free 30
GoRush 26
soO 24
zelot 23
Movie 22
JYJ20
HiyA 20
yabsab 19
IntoTheRainbow 11
Terrorterran 10
Shine 8
ivOry 4
Dota 2
qojqva3148
Gorgc2576
XaKoH 621
XcaliburYe297
syndereN293
League of Legends
singsing2548
Counter-Strike
byalli263
markeloff128
Super Smash Bros
Mew2King169
Other Games
hiko1144
B2W.Neo1138
crisheroes383
Beastyqt345
Lowko310
ArmadaUGS128
Liquid`VortiX84
ZerO(Twitch)24
Organizations
Other Games
gamesdonequick37693
StarCraft: Brood War
UltimateBattle 889
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2960
• WagamamaTV335
League of Legends
• Nemesis5594
Upcoming Events
RotterdaM Event
2h 25m
Replay Cast
10h 25m
Sparkling Tuna Cup
20h 25m
WardiTV European League
1d 2h
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 10h
The PondCast
1d 20h
WardiTV European League
1d 22h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
[ Show More ]
Replay Cast
3 days
RSL Revival
3 days
Classic vs Cure
FEL
4 days
RSL Revival
4 days
FEL
4 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
6 days
BSL20 Non-Korean Champi…
6 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.