littlewhitey's Servers Forum (SA-MP/VC-MP/MTA/Zomboid)

Other => Off-Topic => Programming => Topic started by: SKY on October 09, 2012, 09:20:05 PM

Title: java anyone?
Post by: SKY on October 09, 2012, 09:20:05 PM
Hi guys i just wanted to know if any one else is into coding with languages such as java. I know blewert codes with similar languages, but i wanted to know if anyone else is itnerested in this stuff :D
Title: Re: java anyone?
Post by: Fuse on October 10, 2012, 12:03:32 AM
Why?
Title: Re: java anyone?
Post by: BikeDriver on October 10, 2012, 08:42:44 AM
i can do java, a little html and i am decent with c++
Title: Re: java anyone?
Post by: SKY on October 10, 2012, 12:54:18 PM
i can do java, a little html and i am decent with c++

nice :D im just learning it so far but its intresting if you ask me :P
Title: Re: java anyone?
Post by: Matz on October 10, 2012, 03:59:19 PM
A bit all of them: VB, C++, Pawn.
Title: Re: java anyone?
Post by: BikeDriver on October 10, 2012, 05:38:43 PM
i hate java.. shit never works. i copy some shit into it, compiler says 73 errors. all this fucking classes... your programs are a fucking maze in the end. so freaking annoying.

i love c++. its so... rustic and fundamental

but i still prefer my sage editor for command and conquer generals.. :)
Title: Re: java anyone?
Post by: [eVo]PvtBenny on October 10, 2012, 07:39:28 PM
Im trying to learn HTML5 at school but its not going that well. Basically they just want us to copy stuff from the book and learn it that way lol... I wanne be able to learn HTML5 and CSS3 but its hard for me.
Title: Re: java anyone?
Post by: BikeDriver on October 10, 2012, 08:40:54 PM
Im trying to learn HTML5 at school but its not going that well. Basically they just want us to copy stuff from the book and learn it that way lol... I wanne be able to learn HTML5 and CSS3 but its hard for me.

nub:)

luckily our HTML teacher is awesome.

we use phase5, he usually gives us a screenshot of a website we have to rebuild. and we use some online help database (selfhtml) if there is something we dont know yet.
Title: Re: java anyone?
Post by: EnzoMortelli on October 11, 2012, 01:52:13 PM
i once did some nubzord stuff with java, but i prefer programming with erlang.
Title: Re: java anyone?
Post by: Fuse on October 11, 2012, 02:08:18 PM
C Sharp all the way.
Title: Re: java anyone?
Post by: [eVo]PvtBenny on October 11, 2012, 04:06:42 PM
Im trying to learn HTML5 at school but its not going that well. Basically they just want us to copy stuff from the book and learn it that way lol... I wanne be able to learn HTML5 and CSS3 but its hard for me.

nub:)

luckily our HTML teacher is awesome.

we use phase5, he usually gives us a screenshot of a website we have to rebuild. and we use some online help database (selfhtml) if there is something we dont know yet.

We use different kinds of editors, but im using Coffee Cup, and we use w3schools to check if we dont know something. And we also have to check our codes every time on some website if our code is HTML5 or not.
Title: Re: java anyone?
Post by: Simon on October 11, 2012, 10:52:15 PM
Java is my primary due to both my university and Android depending on it. Other languages I am familiar with include C, C++, C# and obviously Pawn.

I would love to get fully into Python, it's just a matter of time. Perhaps I will have more time at the end of the year to learn it.

C Sharp all the way.

I love C# and the tools Microsoft provides. Microsoft generally treats the developers very well in terms of tools. I would prefer C# to Java (I don't like Oracle) as it seems to be more modern.
Title: Re: java anyone?
Post by: [JOKER]Ya$N on October 11, 2012, 11:24:38 PM
I was deciding to learn java at school but i did something else  :P
Title: Re: java anyone?
Post by: SKY on October 12, 2012, 01:23:00 AM
if anyone is interested i can post my codes for my basic programs here :P. As i said im just learning , i mean the best thing im making so far is a calculator LOL.
Title: Re: java anyone?
Post by: Simon on October 12, 2012, 11:50:00 AM
if anyone is interested i can post my codes for my basic programs here :P. As i said im just learning , i mean the best thing im making so far is a calculator LOL.

Are you self-teaching or learning as part of a course? You should get a Bitbucket or Github account to store your code.
Title: Re: java anyone?
Post by: [eVo]PvtBenny on October 22, 2012, 04:45:49 PM
Well i asked in a conversation with my coach/mentor at school and im getting a bit of java as well. Oh joy... lol
Title: Re: java anyone?
Post by: [eVo]PvtBenny on November 06, 2012, 10:29:21 PM
Srrry for the double post.

But does anyone have a good website with all kinds of info on java like tutorials and such. I kinda want to get a headstart at java before we get it at school so i know what they are actually talking about.

im thinking w3schools.org is good ? I learned pretty much everything i know now about html5 and css3 there.
Title: Re: java anyone?
Post by: Swanson on November 07, 2012, 02:20:21 AM
Hey Benny

Especially for you, the best java lectures I've found so far. Enjoy!

http://www.youtube.com/playlist?list=PL84A56BC7F4A1F852 (http://www.youtube.com/playlist?list=PL84A56BC7F4A1F852)
Title: Re: java anyone?
Post by: BikeDriver on November 07, 2012, 06:00:41 AM
cool.

ill give it a try tomorrow since my java teacher is fully retarded
Title: Re: java anyone?
Post by: [eVo]PvtBenny on November 21, 2012, 05:32:03 PM
Hey Benny

Especially for you, the best java lectures I've found so far. Enjoy!

http://www.youtube.com/playlist?list=PL84A56BC7F4A1F852 (http://www.youtube.com/playlist?list=PL84A56BC7F4A1F852)

Im not gunna be watching all those vids. I need something more simple like w3schools or something you know. Plus those vids are a guaranteed bore for me and ill be likely to fall asleep
Title: Re: java anyone?
Post by: Habdel on November 21, 2012, 05:53:33 PM
I can "code" pawn
Title: Re: java anyone?
Post by: EnzoMortelli on November 22, 2012, 09:48:49 AM
If you can do pawn, you also can do C.
If you can do C, you'd also have no great problems doing java.
Title: Re: java anyone?
Post by: [eVo]PvtBenny on November 28, 2012, 09:54:05 PM
If you can do pawn, you also can do C.
If you can do C, you'd also have no great problems doing java.

With C you mean C++ ?
Title: Re: java anyone?
Post by: Niko_boy on November 29, 2012, 08:05:32 AM
If you can do pawn, you also can do C.
If you can do C, you'd also have no great problems doing java.

With C you mean C++ ?

No C and C++ , are both differnt programming C++ > C
Title: Re: java anyone?
Post by: SKY on December 06, 2012, 06:35:37 PM
Hey guys im back with a question, im making a tic tac toe game in java eclipse. The game is based on using an array so its 2d and it jusy takes the users x and y coordinate to play a X were they want and they try to beat a dumb cpu. Anyways for those using java or who wanwt to help, i was wondering how i would go upon checking the winner for the game? I tried using if statements and for loops but i couldnt get how to specifically get it working. I currently have everything working except the win check.

if you need my code ill post here. Thank please reply or leave a comment
Title: Re: java anyone?
Post by: [eVo]PvtBenny on December 06, 2012, 06:40:32 PM
beat a dumb cpu.

a PLC u mean ? (those are dumb CPU's just FYI)
Title: Re: java anyone?
Post by: SKY on December 07, 2012, 02:15:28 PM
beat a dumb cpu.

a PLC u mean ? (those are dumb CPU's just FYI)

its just a stupid ai lol
Title: Re: java anyone?
Post by: EnzoMortelli on December 07, 2012, 04:03:32 PM
Well, winning tic tac toe is (obviously) a matter of getting 3 stones in either one vertical, horizontal or diagonal line, right? Supposing the tic tac toe field is 3x3 there should be exactly 8 possible ways of achieving this, 3 vertical, 3 horizontal, 2 diagonal. For the sake of simplicity and through sacrificing some efficiency you could simply save those 8 combinations, and compare it with the player's draws. If the pattern the player klicked contains such a row, he wins. Same for ai. If none, no-one wins.

Would be my first idea so far, haven't played it in a while yet, might think about something more later.
Title: Re: java anyone?
Post by: BikeDriver on December 07, 2012, 09:48:23 PM
Hey guys im back with a question, im making a tic tac toe game in java eclipse. The game is based on using an array so its 2d and it jusy takes the users x and y coordinate to play a X were they want and they try to beat a dumb cpu. Anyways for those using java or who wanwt to help, i was wondering how i would go upon checking the winner for the game? I tried using if statements and for loops but i couldnt get how to specifically get it working. I currently have everything working except the win check.

if you need my code ill post here. Thank please reply or leave a comment

how do you read the color of the one field?

if you know that then its a piece of cake because you can simply write all possible winning combinations down stupidly. as enzo said those are only 8 different ways to win.

like this, considering that the colors are black and white and that the fields are named like this:
1 2 3
4 5 6
7 8 9

*IF*
Field 1 = white
and
Field 2 = white
and
Field 3 = white

*OR*
Field 4 = white
and
Field 5 = white
and
Field 6 = white

*OR*
Field 7 = white
and
Field 8 = white
and
Field 9 = white

*OR*
Field 1 = white
and
Field 4 = white
and
Field 7 = white

*OR*
Field 2 = white
and
Field 5 = white
and
Field 8 = white

*OR*
Field 3 = white
and
Field 6 = white
and
Field 9 = white

*OR*
Field 1 = white
and
Field 5 = white
and
Field 9 = white

*OR*
Field 3 = white
and
Field 5 = white
and
Field 7 = white

*THEN*
White wins

unfortunatly i have no idea how your program works so all i can provide is this pseudo code. of course the above code is simplified to the max.
Title: Re: java anyone?
Post by: [eVo]PvtBenny on December 08, 2012, 05:39:13 PM
I obviously need to do some research before i dive into the world of java head first :o
Title: Re: java anyone?
Post by: RebelFreedom on March 11, 2013, 07:10:28 PM
im learning code as well ;) i can change it any wich way i wish usually, but i cant ever write it all from scratch.. i also gotta self teach myself.. any tips for me as well would be much appreciated! awesome! any websites and book names would be good too ;) ima learn C++ and java.. currently reading up on java.. is that bad? i hear u guys dont like it. lol
Title: Re: java anyone?
Post by: SKY on September 21, 2014, 02:50:17 AM
Anyone started to use java recently? Im beginning to learn it at my computer science class.  ;D
Title: Re: java anyone?
Post by: EnzoMortelli on September 21, 2014, 10:10:25 AM
http://imgur.com/gallery/o3I3R (http://imgur.com/gallery/o3I3R) i found this very useful.
Title: Re: java anyone?
Post by: SKY on November 05, 2014, 04:49:25 AM
Hi guy's for my computer science class I been practicing using the string class, I created a method to create three random letter where the first and last are consonants and the middle is a vowel. The method tries to create the word cat. Here is my code http://pastebin.com/VFC1J53T (http://pastebin.com/VFC1J53T) if anyone know's a simpler way to do this please let me know. Also can someone explain why for  k = r.nextInt(21) + 1; , were r is a random object to create a random integer between 1 and 21, I had to add 1? :)
Title: Re: java anyone?
Post by: EnzoMortelli on November 05, 2014, 09:37:59 AM
Code: [Select]
return word;
word = firstWord + secondWord + thirdWord;
System.out.println(word);
the two bottom lines are unreachable code. Return obviously returns from the method to the main program, thus ends the execution flow of the method before your word is set, your return should be NULL. Have you tried this method even once? ???
(Also Eclipse should mark unreachable code)

Simpler way:

Code: [Select]
public static String createWord() {
          String word = "cat";
          return word;
}

r is a random object that is used for random real values between 0 and 1. The method nextInt(int n) returns a pseudorandom integer number between 0 (inclusive) and n (exclusive) on a random object.
Thus r.nextInt(21) gives a random int between 0 and 20, adding +1 shifts the range from 1 to 21.

Code: [Select]
while(true){My laptop overheats just by seeing this.
Title: Re: java anyone?
Post by: Fuse on November 05, 2014, 10:09:51 AM
I made my own version of your code in pawn.
Check it out and you might learn a thing or two, if you're lucky.

http://pastebin.com/wxZfZU9f (http://pastebin.com/wxZfZU9f)

As enzo said above though, there are easier ways to do this, but i guess it's for educational purposes.
Title: Re: java anyone?
Post by: Quickplay on November 05, 2014, 11:03:44 AM
I made my own version of your code in pawn.
Check it out and you might learn a thing or two, if you're lucky.
Lol not even my professors are so "modest", and they are genius  ;D

Btw i don't know how much it could help him since it's another programming language

Code: [Select]
while(true){My laptop overheats just by seeing this.
lmao
Title: Re: java anyone?
Post by: Fuse on November 05, 2014, 12:56:14 PM
Lol not even my professors are so "modest", and they are genius  ;D
what exactly are you implying here? lol
Title: Re: java anyone?
Post by: SKY on November 05, 2014, 03:07:18 PM
Thank's Fuse and Enzo for the help, also I noticed i pasted the wrong code but its the same thing but without the error after the return. http://pastebin.com/jBB61mfr (http://pastebin.com/jBB61mfr)