View previous topic :: View next topic |
Author |
Message |
blingdomepiece
Joined: 03 Aug 2007 Posts: 4358 Location: Ottawa ON Canada
|
Posted: Sun Apr 15, 2012 3:53 pm Post subject: |
|
|
Sarg338 wrote: | I ask the user to input what card they want to obtain from the other user (Five, Six, etc) and put it into a string. My problem is, how do I compare the cards in a hand with a String? Any ideas? |
Can't you write a method that just exhaustively returns the FaceValue for a given string that you pass in? It's not pretty but it will work.
One other thing; since it's Java make sure to use .equals() and not == for string comparisons. _________________
Expert Pro Keys: 50/63 GS, most recent The Killing Moon
Expert Pro Drums: 53/83 GS, most recent Free Bird / Oh My God / Oye Mi Amor
Expert Pro Bass: 6/83 GS, most recent Everybody Wants to Rule the World
|
|
Back to top |
|
|
THABEAST721
Joined: 26 Dec 2007 Posts: 2000
|
Posted: Sun Apr 15, 2012 7:05 pm Post subject: |
|
|
What if you looped through the other player's hand, and retrieved their faceValue for each card in their hand, convert each facevalue to a string, then compare the faceValue string you just retrieved to the faceValue string the other user entered. And yeah you need to use .equals() for comparing strings in java.
Another thought is (although this might be inefficient) is to check what the user requests. If it is a faceValue of 2-10, then just leave it as an int. If they ask for a face card or ace, store the value of what they ask for as an int of like 11, 12, etc depending on what they ask for. Then you could check if their request is equal to each faceValue for every card in the other player's hand. _________________
This does not leave my sig!!! |
|
Back to top |
|
|
THABEAST721
Joined: 26 Dec 2007 Posts: 2000
|
Posted: Sun Apr 15, 2012 8:53 pm Post subject: |
|
|
Huh so I just figured out what codecademy actually is. They are going to post a new lesson each Monday in 2012, teaching about website design. I just finished all the 14 weeks of lessons they had when I started, so I guess I will stay up to date with it and do the new lessons every week.
EDIT: They are just getting started with HTML, and well this intro stuff to it is pretty simple because it looks just like the tags here on SH for bold, quote, url, etc. Are those editors a different language or something? Because they look just like the tags for html like <strong></strong> for bold text in html, and for bold in SH forums. I'm just curious about it I guess.[/quote] _________________
This does not leave my sig!!!
Last edited by THABEAST721 on Sun Apr 15, 2012 9:27 pm; edited 1 time in total |
|
Back to top |
|
|
CamelTower
Joined: 20 Oct 2008 Posts: 477 Location: Wisconsin
|
Posted: Sun Apr 15, 2012 8:58 pm Post subject: |
|
|
taking a programming class this quarter, and it sucks.
AND no one in my dorm that's a programming major can help me, since the class is only teaching Python. just highly unfortunate _________________
FC counts:
GH3 expert [66/70] | GH:OT expert [25/26] | GH:WOR expert [80/93] | GH:OT:MH expert [24/28] | GH:OT:D expert [22/28]
Acc Thread New XBL GT: CamvL
NU Grad 2015 |
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Sun Apr 15, 2012 9:53 pm Post subject: |
|
|
THABEAST721 wrote: | <strong></strong> for bold text in html, and for bold in SH forums. I'm just curious about it I guess. |
I believe that HTML5 is suggesting that people start using <strong></strong> if they want to bold stuff. Same with <em></em> instead of for italics.
One of the reason is because of how screen readers work. If you want to put emphasis on something, when you use <em>, the screen reader would say it differently to let the person know that it's being emphasized. _________________
|
|
Back to top |
|
|
bclare
Joined: 21 Jun 2008 Posts: 6048 Location: Boston
|
Posted: Mon Apr 16, 2012 1:03 am Post subject: |
|
|
THABEAST721 wrote: | They are just getting started with HTML, and well this intro stuff to it is pretty simple because it looks just like the tags here on SH for bold, quote, url, etc. Are those editors a different language or something? Because they look just like the tags for html like <strong></strong> for bold text in html, and for bold in SH forums. I'm just curious about it I guess. | [/quote]
Well forums like SH use BBcode, which is very similar to html, but using square brackets instead of angular, and with less overall capabilities.
I've been going through the javascript stuff on codeacademy, picking it up pretty quick since I've used Java and C++ before so the basics are about the same. Maybe by the time I finish this they'll have more for other languages.
I really hope they can add teacher support, so code academy can be like a more structured version of Khan Academy, but for programming. I'd be interesting in teaching a basic programming class through that. _________________
I'm back I suppose |
|
Back to top |
|
|
blingdomepiece
Joined: 03 Aug 2007 Posts: 4358 Location: Ottawa ON Canada
|
Posted: Mon Apr 16, 2012 1:33 am Post subject: |
|
|
Sarg338 wrote: | I believe that HTML5 is suggesting that people start using <strong></strong> if they want to bold stuff. Same with <em></em> instead of for italics.
|
<strong> and <em> are pretty old... I remember reading guidelines to favor them a decade ago. _________________
Expert Pro Keys: 50/63 GS, most recent The Killing Moon
Expert Pro Drums: 53/83 GS, most recent Free Bird / Oh My God / Oye Mi Amor
Expert Pro Bass: 6/83 GS, most recent Everybody Wants to Rule the World
|
|
Back to top |
|
|
PiemanLK
Joined: 03 Dec 2007 Posts: 4711 Location: /export/home
|
Posted: Mon Apr 16, 2012 1:46 am Post subject: |
|
|
I'm pretty sure these days the standard is to never ever use formatting tags and to define everything using CSS styles. _________________
[quote=''Otend'']Id come up with a long post, but Pieman said what we are all thinking, as usual[/quote]
[quote=''youhas'']EDIT TO ADD: Hey, post #3000! Neat! I will eagerly anticipate my set of ScoreHero-branded steak knives within six to eight weeks.[/quote]
|
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Mon Apr 16, 2012 3:18 am Post subject: |
|
|
blingdomepiece wrote: | Sarg338 wrote: | I believe that HTML5 is suggesting that people start using <strong></strong> if they want to bold stuff. Same with <em></em> instead of for italics.
|
<strong> and <em> are pretty old... I remember reading guidelines to favor them a decade ago. |
Hmm, really? Could've swore that I remember them being the suggested tags to use in HTML5. Hmm, guess not. _________________
|
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Mon Apr 16, 2012 12:12 pm Post subject: |
|
|
blingdomepiece wrote: | Sarg338 wrote: | I ask the user to input what card they want to obtain from the other user (Five, Six, etc) and put it into a string. My problem is, how do I compare the cards in a hand with a String? Any ideas? |
Can't you write a method that just exhaustively returns the FaceValue for a given string that you pass in? It's not pretty but it will work.
One other thing; since it's Java make sure to use .equals() and not == for string comparisons. |
Thanks man, works perfectly! I just created a placeholder card, passed in the inputted string into a function, and made a switch case to change the placeholder Card's facevalue to the string, and use that for comparison. Never thought of doing that, maybe I just thought that there would be an easier way xD
And yeah, the .equals thing instead of == was something the teacher covered in class, so I used that! _________________
|
|
Back to top |
|
|
blingdomepiece
Joined: 03 Aug 2007 Posts: 4358 Location: Ottawa ON Canada
|
Posted: Mon Apr 16, 2012 1:47 pm Post subject: |
|
|
Sarg338 wrote: | Thanks man, works perfectly! I just created a placeholder card, passed in the inputted string into a function, and made a switch case to change the placeholder Card's facevalue to the string, and use that for comparison. Never thought of doing that, maybe I just thought that there would be an easier way xD |
Oh, wouldn't surprise me if there is a more clever approach. And if you had something like 250 face values, you would really want to figure one out. But in this case you can be done in two or three minutes, and the method is easy to understand if someone else had to maintain it. If I was reviewing a patch with that fix I'd be fine with it.
Quote: | And yeah, the .equals thing instead of == was something the teacher covered in class, so I used that! |
I got bit by it when we first moved from C# to Java.
PiemanLK wrote: | I'm pretty sure these days the standard is to never ever use formatting tags and to define everything using CSS styles. |
I am not an expert in the area but yeah, I think most "real" web-sites use CSS for everything. _________________
Expert Pro Keys: 50/63 GS, most recent The Killing Moon
Expert Pro Drums: 53/83 GS, most recent Free Bird / Oh My God / Oye Mi Amor
Expert Pro Bass: 6/83 GS, most recent Everybody Wants to Rule the World
|
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Fri Apr 27, 2012 4:43 am Post subject: |
|
|
Just thought I would post this, me and my partner just finished our final project for my Game Development class and we ended up making a Tower Defense game for it (We had about 2-3 weeks to do it). Thought I would post the game and code incase anyone is interested!
Linky
Just unpack it, and run it from a compiler, or run the .exe from GameStateManagementSample/bin/x86/debug/GameStateManagementSample.exe
Better name would've been better, but we used the GameStateManagementSample (Obviously) provided by Microsoft for menus and just built it from there.
You can right-click to sell towers for half of their build price (Something I just added 20 minutes ago), 50 waves, and just a warning, the sounds get annoying after you put a few towers on the field, lol.
Would this be something worth putting on a resume? I mean, to me it seems pretty trivial compared to some projects, but putting something is better than nothing!
Anyways, if anyone does play it, let me know what you think, suggestions/bugs/etc! _________________
|
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Fri May 11, 2012 7:56 pm Post subject: |
|
|
Taking Operating Systems for 2 weeks right now, and it's pretty fun. Just finished my first program in Perl, and I have to say, it's a really cool language, especially with how easy it is to parse input. Enjoying it so far! _________________
|
|
Back to top |
|
|
Sarg338
Joined: 07 Feb 2008 Posts: 5143
|
Posted: Thu Aug 02, 2012 6:24 pm Post subject: |
|
|
Bumping this up since I've been using Code Academy during the Summer for a bit of Javascript/HTML learning. They also just added a Python course so I'll probably do that during this semester in addition to my Parallel Programming course. I've found that using this site is usually better and more fun than just following videos! _________________
|
|
Back to top |
|
|
bclare
Joined: 21 Jun 2008 Posts: 6048 Location: Boston
|
Posted: Thu Aug 02, 2012 10:47 pm Post subject: |
|
|
I like code academy. I signed up to be a beta tester or whatever for their Python classes, I haven't gotten around to taking a look yet. Maybe this weekend. _________________
I'm back I suppose |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Copyright © 2006-2024 ScoreHero, LLC
|
Powered by phpBB
|