Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PIXELWAR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIXELWAR_IA04
PIXELWAR
Merge requests
!21
Creation agents front
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Creation agents front
creation_agents_front
into
main
Overview
0
Commits
7
Pipelines
0
Changes
8
Merged
Pierre Gibertini
requested to merge
creation_agents_front
into
main
2 years ago
Overview
0
Commits
7
Pipelines
0
Changes
8
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
319c104d
7 commits,
2 years ago
8 files
+
207
−
54
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
agent/server/launch.go
0 → 100644
+
42
−
0
Options
package
server
import
(
"bytes"
"encoding/json"
"fmt"
agt
"gitlab.utc.fr/pixelwar_ia04/pixelwar/agent"
"gitlab.utc.fr/pixelwar_ia04/pixelwar/launcher"
"net/http"
)
func
(
*
Server
)
decodeLaunchRequest
(
r
*
http
.
Request
)
(
req
agt
.
LaunchRequest
,
err
error
)
{
buf
:=
new
(
bytes
.
Buffer
)
buf
.
ReadFrom
(
r
.
Body
)
err
=
json
.
Unmarshal
(
buf
.
Bytes
(),
&
req
)
return
}
func
(
srv
*
Server
)
launch
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
srv
.
Lock
()
defer
srv
.
Unlock
()
// vérification de la méthode de la requête
if
!
srv
.
checkMethod
(
"POST"
,
w
,
r
)
{
return
}
// décodage de la requête
req
,
err
:=
srv
.
decodeLaunchRequest
(
r
)
if
err
!=
nil
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
fmt
.
Fprint
(
w
,
err
.
Error
())
return
}
placeID
:=
launcher
.
LaunchPixelWar
(
req
.
Random
,
req
.
Propo
,
req
.
NbAgents
,
req
.
Cooldown
,
req
.
Size
,
1
,
1
,
false
)
serial
,
_
:=
json
.
Marshal
(
placeID
)
w
.
Write
(
serial
)
w
.
WriteHeader
(
http
.
StatusOK
)
}
Loading