nedoPC.org

Electronics hobbyists community established in 2002
Atom Feed | View unanswered posts | View active topics It is currently 16 Apr 2024 15:06



Reply to topic  [ 4 posts ] 
Игра Colobot 
Author Message
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22520
Location: Silicon Valley
Reply with quote
А кто помнит игру Colobot, где можно было программировать ботов - я лично в неё много играл в 2002 году:


Плейлист: https://www.youtube.com/watch?v=XpTuwBSI0QU&list=PLAguonoUkih4Sgvare9qjU32dxhlCs3Ay

https://ru.wikipedia.org/wiki/Colobot

P.S. Какое-то время назад её опенсорцнули и теперь энтузиасты развивают её как открытый программный продукт: https://github.com/colobot/colobot

_________________
:dj: https://mastodon.social/@Shaos


22 Oct 2021 23:02
Profile WWW
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22520
Location: Silicon Valley
Reply with quote
В англоязычной википедии есть пример программы для бота:

Code:
extern void object::FetchTitanium()
{
   object item; // declare variable
      
   item = radar(TitaniumOre); // find a piece of titanium ore
   goto(item.position); // go to the ore
   grab(); // pick up whatever is in front of the robot (presumably the ore)
   
   item = radar(Converter); // find the ore converter
   goto(item.position); // relocate to the converter
   drop(); // drop the piece of ore
   move(-2.5); // back up 2.5 meters to allow the converter to start processing the ore
}


https://en.wikipedia.org/wiki/Colobot

Я помню, что я писал программу, по которой роботы искали в чистом поле кубики руды, приносили их печке и выкладывали их рядами :)
Так надо было делать потому, что печка перетапливала руду медленнее, чем роботы успевали её собирать ;)

_________________
:dj: https://mastodon.social/@Shaos


22 Oct 2021 23:05
Profile WWW
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
Shaos wrote:
А кто помнит игру Colobot, где можно было программировать ботов ...

Впервые слышу это слово в принципе, не то, чтобы помнить его... :ebiggrin:

_________________
iLavr


23 Oct 2021 04:47
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22520
Location: Silicon Valley
Reply with quote
Shaos wrote:
В англоязычной википедии есть пример программы для бота:

Code:
extern void object::FetchTitanium()
{
   object item; // declare variable
      
   item = radar(TitaniumOre); // find a piece of titanium ore
   goto(item.position); // go to the ore
   grab(); // pick up whatever is in front of the robot (presumably the ore)
   
   item = radar(Converter); // find the ore converter
   goto(item.position); // relocate to the converter
   drop(); // drop the piece of ore
   move(-2.5); // back up 2.5 meters to allow the converter to start processing the ore
}
Я когда-то планировал на своём "Robot Warfare 1" что-то подобное сделать - например у меня уже есть команда поиска объекта:
Quote:
RADAR Var

Запускает радар на поиск объекта типа Var = 0..7 (можно
воспользоваться макроопределениями из RW1_STD.RWI.
Координаты найденного объекта относительно робота
помещаются в регистры X и Y, если же оба
регистра равны 0, то объект не найден. В регитстре K
возвращается квадрант объекта (относительно
робота - против часовой стрелки 0,1,2,3), в регистре
D - минимальное абсолютное значение координат.
Занимает 1 такт. Отнимает 1 единицу энергии.
А вот простой команды "ИдиТуда" нет - надо будет из библиотеки подпрограмм брать - будет что-то типа вот этого из робота, который умел ходить туда, где кликнули мышой:
Code:
robot "Mouse"
author "SHAOS"
color 808080
front eye
back gun
+rw1_std.rwi
main()
{
  buf = 0
  recv buf
  say "N=&N "
  if(N==@mouse) // received code from mouse
  {
   say "receive X=&X Y=&Y buf=&BUF "
   xx=X
   yy=Y
   if(yy<=0)
   {
     left;left
     yy = -yy
     xx = -xx
   }
   while(1)
   {
    act front
    if(d==1)
    {
      if(n==1) break
      if(n==2) call attack
      if(n==6) call attack
      if(n==5) call attack
      step
    }
    else step
    yy=yy-1
    if(yy>0) continue
    if(xx==0) break
    if(xx>0)
    {
       right
       yy=xx
       xx=0
    }
    else
    {
       left
       yy=-xx
       xx=0
    }
   }
  }
  else
  {
   act front
   if(N==@t_robot) call attack
   else
   {
      if(N==@t_box||D>1) step
      else
      {
         if(R>500) right
         else left
      }
   }
  }
}

attack()
{
  left;left
  act back
  act back
  act back
  act back
  act back
  left;left
}

Потом кроме оборудования GUN и EYE можно добавить оборудование ARM (рука) и активация её рядом с объектом будет означать "хватание" объекта (а активация если нечего хватать будет означать "бросание")

_________________
:dj: https://mastodon.social/@Shaos


23 Oct 2021 15:47
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 16 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.