topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 6:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Code Combat!  (Read 13238 times)

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Code Combat!
« on: December 05, 2014, 10:49 PM »
I considered posting this in Developer's Corner, but I think it should live here...

CodeCombat: Learn to Code by Playing a Game
Learn programming with a multiplayer live coding strategy game. You're a wizard, and your spells are JavaScript.


Well, Javascript & Python, with experimental use of Lua, Clojure, and a few others.

I played through a few levels, at first it was a bit boring, as you are limited to directions - 'self.moveRight()', that kind of thing.  But like any good adventure game, you pick up money and items along the way and are shown new programming tricks to access new your new abilities and items to get through the different mazes.  Very good for introducing programming to pre-to-mid-teens who haven't already picked up some javascript...


from TechRepublic - 10 Toys and Games that Teach Coding
« Last Edit: December 06, 2014, 04:07 AM by Edvard »

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,288
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Code Combat!
« Reply #1 on: December 06, 2014, 12:03 AM »
That's a really damn cool game!!!  :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup:
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,288
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Code Combat!
« Reply #2 on: December 06, 2014, 07:21 AM »
Here's an SS of my character a few problems ago.

Screenshot - 2014_12_06 , 11_30_50 PM.png

Here's the first solution:

Code: Javascript [Select]
  1. // Move to the gem.
  2. // Don't touch the walls!
  3. // Type your code below.
  4.  
  5. this.moveRight();
  6. this.moveDown();
  7. this.moveRight();

So, very simple to get you used to the game. It adds methods/functions (I hate how JS uses "function" for everything when they would be better off distinguishing.)

this.moveXY(x, y); comes a bit later.

Here's an example of a problem solution:

Code: Javascript [Select]
  1. var enemy = this.findNearestEnemy();
  2. var count = 1;
  3. loop {
  4.         enemy = this.findNearestEnemy();
  5.         if (enemy)
  6.         {
  7.                 if (this.isReady("cleave"))
  8.                 {
  9.                         this.cleave(enemy);
  10.                 } else {
  11.                         this.shield();
  12.                 }
  13.         }
  14. }


Here's a problem:

Code: Javascript [Select]
  1. // Collect all the coins in each meadow.
  2. // Use flags to move between meadows.
  3. // Press Submit when you are ready to place flags.
  4.  
  5. loop {
  6.     var flag = this.findFlag();
  7.     if (flag) {
  8.         // Pick up the flag.
  9.  
  10.     } else {
  11.         // Automatically move to the nearest item you see.
  12.         var item = this.findNearestItem();
  13.         if (item) {
  14.             var position = item.pos;
  15.             var x = position.x;
  16.             var y = position.y;
  17.             this.moveXY(x, y);
  18.         }
  19.     }
  20. }

And the solution:

Code: Javascript [Select]
  1. // Collect all the coins in each meadow.
  2. // Use flags to move between meadows.
  3. // Press Submit when you are ready to place flags.
  4.  
  5. loop {
  6.     var flag = this.findFlag();
  7.     if (flag) {
  8.         // Pick up the flag.
  9.         this.pickUpFlag(flag);
  10.     } else {
  11.         // Automatically move to the nearest item you see.
  12.         var item = this.findNearestItem();
  13.         if (item) {
  14.             var position = item.pos;
  15.             var x = position.x;
  16.             var y = position.y;
  17.             this.moveXY(x, y);
  18.         }
  19.     }
  20. }

Which shows how they gently ease you into new methods/functions.

They have a business model as well.

Screenshot - 2014_12_07 , 12_03_45 AM.png

It's also open source.

Like... dammit... this is a friggin' cool game. This is the kind of game parents should PAY their kids to play! It's. That. Damn. Good.

Cudos to the developers. They've created a truly useful, brilliant game.

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

bit

  • Supporting Member
  • Joined in 2013
  • **
  • Posts: 686
    • View Profile
    • Donate to Member
Re: Code Combat!
« Reply #3 on: December 06, 2014, 06:31 PM »
^Yes, this is totally awesome.  :Thmbsup:
« Last Edit: March 04, 2015, 10:29 AM by bit »

rxantos

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 116
    • View Profile
    • Donate to Member
Re: Code Combat!
« Reply #4 on: January 29, 2015, 11:08 PM »
Interesting and addictive game. Thanks for sharing the link.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,900
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Code Combat!
« Reply #5 on: January 29, 2015, 11:18 PM »
Another programming game I stumbled on seems much more focused on hard core or at least more efficiency-minded coders, but is very cool:
http://play.elevatorsaga.com/

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,288
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Code Combat!
« Reply #6 on: January 30, 2015, 08:01 PM »
Another programming game I stumbled on seems much more focused on hard core or at least more efficiency-minded coders, but is very cool:
http://play.elevatorsaga.com/

Interesting. And yes - very much "hard core". There's no tutorial to get you up to speed, but there is a wiki, so you can study the API, but you're very much just left on your own.

I've been traveling the last week, and had lots of elevators. Funnily enough, I was thinking a few times about elevator algorithms. Some are really good, and others, not so much.
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker